diff --git a/infer/src/backend/InferAnalyze.ml b/infer/src/backend/InferAnalyze.ml index b7b13926f..c19bc0955 100644 --- a/infer/src/backend/InferAnalyze.ml +++ b/infer/src/backend/InferAnalyze.ml @@ -136,7 +136,9 @@ let main ~changed_files ~makefile = | Some fname -> process_cluster_cmdline fname | None -> - if Config.allow_specs_cleanup then DB.Results_dir.clean_specs_dir () ; + (* delete all specs when doing a full analysis so that we do not report on procedures that do + not exist anymore *) + if not Config.reactive_mode then DB.Results_dir.clean_specs_dir () ; let all_clusters = DB.find_source_dirs () in let clusters_to_analyze = List.filter ~f:(cluster_should_be_analyzed ~changed_files) all_clusters diff --git a/infer/src/base/Config.ml b/infer/src/base/Config.ml index bd5460b26..6fc99b9ba 100644 --- a/infer/src/base/Config.ml +++ b/infer/src/base/Config.ml @@ -597,11 +597,6 @@ and allow_leak = CLOpt.mk_bool ~deprecated:["leak"] ~long:"allow-leak" "Forget leaked memory during abstraction" -and allow_specs_cleanup = - CLOpt.mk_bool ~deprecated:["allow_specs_cleanup"] ~long:"allow-specs-cleanup" ~default:true - "Allow to remove existing specs before running analysis when it's not incremental" - - and ( analysis_blacklist_files_containing_options , analysis_path_regex_blacklist_options , analysis_path_regex_whitelist_options @@ -2264,8 +2259,6 @@ and abs_struct = !abs_struct and abs_val_orig = !abs_val -and allow_specs_cleanup = !allow_specs_cleanup - and analysis_path_regex_whitelist_options = List.map ~f:(fun (a, b) -> (a, !b)) analysis_path_regex_whitelist_options diff --git a/infer/src/base/Config.mli b/infer/src/base/Config.mli index 866b35b6f..85ead2cf2 100644 --- a/infer/src/base/Config.mli +++ b/infer/src/base/Config.mli @@ -282,8 +282,6 @@ val rest : string list val abs_struct : int -val allow_specs_cleanup : bool - val analysis_path_regex_whitelist : analyzer -> string list val analysis_path_regex_blacklist : analyzer -> string list diff --git a/infer/src/base/DB.ml b/infer/src/base/DB.ml index 2f36c098e..2281a5c11 100644 --- a/infer/src/base/DB.ml +++ b/infer/src/base/DB.ml @@ -240,10 +240,10 @@ module Results_dir = struct let clean_specs_dir () = - Utils.create_dir specs_dir ; (* create dir just in case it doesn't exist to avoid errors *) - let files_to_remove = Array.map ~f:(Filename.concat specs_dir) (Sys.readdir specs_dir) in - Array.iter ~f:Sys.remove files_to_remove + Utils.create_dir specs_dir ; + Array.iter (Sys.readdir specs_dir) ~f:(fun specs -> + Filename.concat specs_dir specs |> Sys.remove ) (** create a file at the given path, creating any missing directories *)