diff --git a/infer/src/base/Config.mli b/infer/src/base/Config.mli index ceb2c255e..95c7a231a 100644 --- a/infer/src/base/Config.mli +++ b/infer/src/base/Config.mli @@ -12,9 +12,6 @@ open! IStd time by system calls, environment variables, or command line options *) type analyzer = CaptureOnly | CompileOnly | Checkers | Crashcontext | Linters -[@@deriving compare] - -val equal_analyzer : analyzer -> analyzer -> bool val string_to_analyzer : (string * analyzer) list (** Association list of analyzers and their names *) diff --git a/infer/src/clang/Capture.ml b/infer/src/clang/Capture.ml index cbaa833c3..22de3ecd5 100644 --- a/infer/src/clang/Capture.ml +++ b/infer/src/clang/Capture.ml @@ -150,7 +150,7 @@ let cc1_capture clang_cmd = in L.(debug Capture Quiet) "@\n*** Beginning capture of file %s ***@\n" source_path ; if - Config.equal_analyzer Config.analyzer Config.CompileOnly + InferCommand.equal Config.command Compile || (not Config.skip_analysis_in_path_skips_compilation) && CLocation.is_file_blacklisted source_path then ( diff --git a/infer/src/integration/Buck.ml b/infer/src/integration/Buck.ml index d3961c57e..dcc07b8b1 100644 --- a/infer/src/integration/Buck.ml +++ b/infer/src/integration/Buck.ml @@ -34,17 +34,13 @@ module Target = struct let add_flavor ~extra_flavors target = let target = List.fold_left ~f:add_flavor_internal ~init:target extra_flavors in - match (Config.buck_compilation_database, Config.analyzer) with + match (Config.buck_compilation_database, Config.command) with | Some _, _ -> add_flavor_internal target "compilation-database" - | None, CompileOnly -> + | None, Compile -> target - | None, (CaptureOnly | Checkers | Linters) -> + | None, _ -> add_flavor_internal target "infer-capture-all" - | None, Crashcontext -> - L.(die UserError) - "Analyzer %s is Java-only; not supported with Buck flavors" - (Config.string_of_analyzer Config.analyzer) end let parse_target_string = diff --git a/infer/src/integration/Driver.ml b/infer/src/integration/Driver.ml index a6fd4a842..304989da7 100644 --- a/infer/src/integration/Driver.ml +++ b/infer/src/integration/Driver.ml @@ -376,18 +376,16 @@ let error_nothing_to_analyze mode = let analyze_and_report ?suppress_console_report ~changed_files mode = let should_analyze, should_report = - match (Config.command, mode, Config.analyzer) with - | _, PythonCapture (BBuck, _), _ when not Config.flavors -> + match (Config.command, mode) with + | _, PythonCapture (BBuck, _) when not Config.flavors -> (* In Buck mode when compilation db is not used, analysis is invoked from capture if buck flavors are not used *) (false, false) | _ when Config.infer_is_clang || Config.infer_is_javac -> (* Called from another integration to do capture only. *) (false, false) - | _, _, Linters -> - (false, true) - | (Capture | Compile), _, _ | _, _, (CaptureOnly | CompileOnly) -> + | (Capture | Compile | Events | Explore | Report | ReportDiff), _ -> (false, false) - | _, _, (Checkers | Crashcontext) -> + | (Analyze | Diff | Run), _ -> (true, true) in let should_merge = @@ -556,8 +554,7 @@ let run_epilogue mode = if CLOpt.is_originator then ( let in_buck_mode = match mode with PythonCapture (BBuck, _) -> true | _ -> false in if Config.developer_mode then StatsAggregator.generate_files () ; - if Config.equal_analyzer Config.analyzer Config.Crashcontext then - Crashcontext.crashcontext_epilogue ~in_buck_mode ; + if Config.crashcontext then Crashcontext.crashcontext_epilogue ~in_buck_mode ; if Config.fail_on_bug then fail_on_issue_epilogue () ; () ) ; if Config.buck_cache_mode then clean_results_dir () ; diff --git a/infer/src/integration/Javac.ml b/infer/src/integration/Javac.ml index 6e36ffdc9..03dae56d9 100644 --- a/infer/src/integration/Javac.ml +++ b/infer/src/integration/Javac.ml @@ -108,5 +108,6 @@ let capture compiler ~prog ~args = () | _ -> let verbose_out_file = compile compiler prog args in - if Config.analyzer <> Config.CompileOnly then JMain.from_verbose_out verbose_out_file ; + if not (InferCommand.equal Config.command Compile) then + JMain.from_verbose_out verbose_out_file ; if not Config.debug_mode then Unix.unlink verbose_out_file