diff --git a/infer/src/base/SourceFile.ml b/infer/src/base/SourceFile.ml index e1fda203c..a9196f21c 100644 --- a/infer/src/base/SourceFile.ml +++ b/infer/src/base/SourceFile.ml @@ -276,6 +276,19 @@ let changed_sources_from_changed_files changed_files = with _exn -> changed_files_set ) +let read_config_changed_files () = + match Config.changed_files_index with + | None -> + None + | Some index -> ( + match Utils.read_file index with + | Ok lines -> + Some (changed_sources_from_changed_files lines) + | Error error -> + L.external_error "Error reading the changed files index '%s': %s@." index error ; + None ) + + module SQLite = struct type nonrec t = t diff --git a/infer/src/base/SourceFile.mli b/infer/src/base/SourceFile.mli index eac540530..9c241ef1c 100644 --- a/infer/src/base/SourceFile.mli +++ b/infer/src/base/SourceFile.mli @@ -20,9 +20,9 @@ module Hash : Caml.Hashtbl.S with type key = t val is_invalid : t -> bool (** Is the source file the invalid source file? *) -val changed_sources_from_changed_files : string list -> Set.t -(** Set of files read from --changed-files-index file, None if option not specified NOTE: it may - include extra source_files if --changed-files-index contains paths to header files *) +val read_config_changed_files : unit -> Set.t option +(** return the list of changed files as read from Config.changed_files_index. NOTE: it may include + extra source_files if --changed-files-index contains paths to header files. *) val invalid : string -> t (** Invalid source file *) diff --git a/infer/src/infer.ml b/infer/src/infer.ml index dc7298a7a..66bb3f95e 100644 --- a/infer/src/infer.ml +++ b/infer/src/infer.ml @@ -15,7 +15,7 @@ module L = Logging let run driver_mode = let open Driver in run_prologue driver_mode ; - let changed_files = read_config_changed_files () in + let changed_files = SourceFile.read_config_changed_files () in InferAnalyze.invalidate_changed_procedures changed_files ; capture driver_mode ~changed_files ; analyze_and_report driver_mode ~changed_files ; diff --git a/infer/src/integration/Driver.ml b/infer/src/integration/Driver.ml index 3fb0b227c..21875eb30 100644 --- a/infer/src/integration/Driver.ml +++ b/infer/src/integration/Driver.ml @@ -466,16 +466,3 @@ let run_epilogue () = let run_epilogue () = GCStats.log ~name:"main_process_full" Analysis (GCStats.get ~since:ProgramStart) ; ScubaLogging.execute_with_time_logging "run_epilogue" run_epilogue - - -let read_config_changed_files () = - match Config.changed_files_index with - | None -> - None - | Some index -> ( - match Utils.read_file index with - | Ok lines -> - Some (SourceFile.changed_sources_from_changed_files lines) - | Error error -> - L.external_error "Error reading the changed files index '%s': %s@." index error ; - None ) diff --git a/infer/src/integration/Driver.mli b/infer/src/integration/Driver.mli index 12c05f202..846fbb68b 100644 --- a/infer/src/integration/Driver.mli +++ b/infer/src/integration/Driver.mli @@ -46,7 +46,3 @@ val analyze_and_report : val run_epilogue : unit -> unit (** cleanup infer-out/ for Buck, generate stats, and generally post-process the results of a run *) - -val read_config_changed_files : unit -> SourceFile.Set.t option -(** return the list of changed files as read from Config.changed_files_index and passed to - SourceFile.changed_sources_from_changed_files *)