From 5773a903c678adcafe2767361f8e9aef51997e6a Mon Sep 17 00:00:00 2001 From: Jeremy Dubreil Date: Sun, 14 May 2017 17:57:40 -0700 Subject: [PATCH] [infer][checkers] remove the unecessary 'checkers' flag Summary: This flag is no longer useful Depends on D5057088 Reviewed By: jberdine Differential Revision: D5058493 fbshipit-source-id: 55b47ea --- infer/src/backend/InferAnalyze.re | 29 ++++++++++++++++------------- infer/src/backend/errdesc.ml | 3 +-- infer/src/base/Config.ml | 15 +++++---------- infer/src/base/Config.mli | 1 - infer/src/base/ZipLib.ml | 2 +- 5 files changed, 23 insertions(+), 27 deletions(-) diff --git a/infer/src/backend/InferAnalyze.re b/infer/src/backend/InferAnalyze.re index b200bd457..af51dc337 100644 --- a/infer/src/backend/InferAnalyze.re +++ b/infer/src/backend/InferAnalyze.re @@ -21,19 +21,11 @@ let analyze_exe_env_tasks cluster exe_env :Tasks.t => { L.log_progress_file (); Specs.clear_spec_tbl (); Random.self_init (); - if Config.checkers { - /* run the checkers only */ - Tasks.create [ - fun () => { - let call_graph = Exe_env.get_cg exe_env; - Callbacks.iterate_callbacks call_graph exe_env; - if Config.write_html { - Printer.write_all_html_files cluster - } - } - ] - } else { - /* run the full analysis */ + let biabduction_only = + Config.equal_analyzer Config.analyzer Config.BiAbduction || + Config.equal_analyzer Config.analyzer Config.Tracing; + if biabduction_only { + /* run the biabduction analysis only */ Tasks.create (Interproc.do_analysis_closures exe_env) continuation::( @@ -52,6 +44,17 @@ let analyze_exe_env_tasks cluster exe_env :Tasks.t => { None } ) + } else { + /* run the registered checkers */ + Tasks.create [ + fun () => { + let call_graph = Exe_env.get_cg exe_env; + Callbacks.iterate_callbacks call_graph exe_env; + if Config.write_html { + Printer.write_all_html_files cluster + } + } + ] } }; diff --git a/infer/src/backend/errdesc.ml b/infer/src/backend/errdesc.ml index b1a3a9efc..bf8b3d0a5 100644 --- a/infer/src/backend/errdesc.ml +++ b/infer/src/backend/errdesc.ml @@ -216,7 +216,6 @@ let rec find_boolean_assignment node pvar true_branch : Procdesc.Node.t option = (** Find the Load instruction used to declare normal variable [id], and return the expression dereferenced to initialize [id] *) let rec _find_normal_variable_load tenv (seen : Exp.Set.t) node id : DExp.t option = - let is_infer = not (Config.checkers || Config.eradicate) in let find_declaration node = function | Sil.Load (id0, e, _, _) when Ident.equal id id0 -> if verbose @@ -248,7 +247,7 @@ let rec _find_normal_variable_load tenv (seen : Exp.Set.t) node id : DExp.t opti List.map ~f:unNone args_dexpo in Some (DExp.Dretcall (fun_dexp, args_dexp, loc, call_flags)) | Sil.Store (Exp.Lvar pvar, _, Exp.Var id0, _) - when is_infer && Ident.equal id id0 && not (Pvar.is_frontend_tmp pvar) -> + when Config.biabduction && Ident.equal id id0 && not (Pvar.is_frontend_tmp pvar) -> (* this case is a hack to make bucketing continue to work in the presence of copy propagation. previously, we would have code like: n1 = foo(); x = n1; n2 = x; n2.toString(), but copy-propagation will optimize this to: diff --git a/infer/src/base/Config.ml b/infer/src/base/Config.ml index 2d270cbe2..5509cda5e 100644 --- a/infer/src/base/Config.ml +++ b/infer/src/base/Config.ml @@ -608,10 +608,6 @@ and checkers_repeated_calls = CLOpt.mk_bool ~long:"checkers-repeated-calls" ~in_help:CLOpt.[Analyze, manual_generic] "check for repeated calls" -and checkers = - CLOpt.mk_bool ~long:"checkers" ~in_help:CLOpt.[Analyze, manual_generic] - "the checkers instead of the full analysis" - and clang_biniou_file = CLOpt.mk_path_opt ~long:"clang-biniou-file" ~in_help:CLOpt.[Capture, manual_clang] ~meta:"file" @@ -1594,11 +1590,11 @@ let post_parsing_initialization command_opt = linters_def_file := linters_def_default_file :: !linters_def_file; (match !analyzer with - | Some Checkers -> checkers := true - | Some Crashcontext -> checkers := true; crashcontext := true - | Some Eradicate -> checkers := true; eradicate := true - | Some Tracing -> tracing := true - | Some (CaptureOnly | CompileOnly | BiAbduction | Linters) -> () + | Some BiAbduction -> biabduction := true + | Some Crashcontext -> crashcontext := true + | Some Eradicate -> eradicate := true + | Some Tracing -> biabduction := true; tracing := true + | Some (CaptureOnly | CompileOnly | Checkers | Linters) -> () | None -> let open CLOpt in match command_opt with @@ -1681,7 +1677,6 @@ and bugs_txt = !bugs_txt and changed_files_index = !changed_files_index and calls_csv = !calls_csv and dump_duplicate_symbols = !dump_duplicate_symbols -and checkers = !checkers and checkers_repeated_calls = !checkers_repeated_calls and clang_biniou_file = !clang_biniou_file and clang_ignore_regex = !clang_ignore_regex diff --git a/infer/src/base/Config.mli b/infer/src/base/Config.mli index 82ff9312b..a9ca83179 100644 --- a/infer/src/base/Config.mli +++ b/infer/src/base/Config.mli @@ -189,7 +189,6 @@ val calls_csv : string option (** directory where the results of the capture phase are stored *) val captured_dir : string -val checkers : bool val checkers_repeated_calls : bool val clang_biniou_file : string option val clang_frontend_action_string : string diff --git a/infer/src/base/ZipLib.ml b/infer/src/base/ZipLib.ml index dd0872715..829bd99aa 100644 --- a/infer/src/base/ZipLib.ml +++ b/infer/src/base/ZipLib.ml @@ -79,7 +79,7 @@ let zip_libraries = (* fname is a dir of specs *) zip_libs in List.fold ~f:add_zip ~init:[] Config.specs_library in - if Config.checkers then + if not Config.biabduction then zip_libs else if (Sys.file_exists Config.models_jar) = `Yes then (mk_zip_lib true Config.models_jar) :: zip_libs