[kill -a][0/4] do not rely on `Config.analyzer`

Summary: Use the value of other options instead since we're trying to get rid of it. This should be equivalent.

Reviewed By: jeremydubreil

Differential Revision: D9943274

fbshipit-source-id: 055e1bdd2
master
Jules Villard 6 years ago committed by Facebook Github Bot
parent 878add3fad
commit c257f68226

@ -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 *)

@ -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 (

@ -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 =

@ -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 () ;

@ -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

Loading…
Cancel
Save