From f98045a9a8f271251eecd69999b3ced0c057a1b8 Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Thu, 19 Dec 2019 09:47:49 -0800 Subject: [PATCH] [driver] no need for `Driver.equal_mode` Summary: This generates a lot of code (the datatype is not trivial) and transitively requires other datatypes to have compare functions, just so we can then ask whether the mode is "Analyze". Reviewed By: ngorogiannis Differential Revision: D19164589 fbshipit-source-id: be6a12b41 --- infer/src/base/Config.mli | 2 -- infer/src/infer.ml | 4 ++-- infer/src/integration/Driver.ml | 3 +-- infer/src/integration/Driver.mli | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/infer/src/base/Config.mli b/infer/src/base/Config.mli index 03a0a0957..80852ca6b 100644 --- a/infer/src/base/Config.mli +++ b/infer/src/base/Config.mli @@ -18,7 +18,6 @@ type compilation_database_dependencies = (** get the compilation database of the dependencies up to depth n by [Deps (Some n)], or all by [Deps None] *) | NoDeps -[@@deriving compare] type build_system = | BAnt @@ -31,7 +30,6 @@ type build_system = | BMvn | BNdk | BXcode -[@@deriving compare] val equal_build_system : build_system -> build_system -> bool diff --git a/infer/src/infer.ml b/infer/src/infer.ml index 5e955b5f0..f98324100 100644 --- a/infer/src/infer.ml +++ b/infer/src/infer.ml @@ -47,7 +47,7 @@ let setup () = [Driver.clean_results_dir ()]). *) (buck && flavors) || genrule_mode) || not - ( Driver.(equal_mode driver_mode Analyze) + ( Driver.is_analyze_mode driver_mode || Config.( continue_capture || infer_is_clang || infer_is_javac || reactive_mode || incremental_analysis) ) @@ -55,7 +55,7 @@ let setup () = ResultsDir.create_results_dir () ; if CLOpt.is_originator && (not Config.continue_capture) - && not Driver.(equal_mode driver_mode Analyze) + && not (Driver.is_analyze_mode driver_mode) then ( db_start () ; SourceFiles.mark_all_stale () ) | Explore -> ResultsDir.assert_results_dir "please run an infer analysis first" diff --git a/infer/src/integration/Driver.ml b/infer/src/integration/Driver.ml index 019c7436c..9be9d76a8 100644 --- a/infer/src/integration/Driver.ml +++ b/infer/src/integration/Driver.ml @@ -25,9 +25,8 @@ type mode = | Maven of string * string list | PythonCapture of Config.build_system * string list | XcodeXcpretty of string * string list -[@@deriving compare] -let equal_mode = [%compare.equal: mode] +let is_analyze_mode = function Analyze -> true | _ -> false let pp_mode fmt = function | Analyze -> diff --git a/infer/src/integration/Driver.mli b/infer/src/integration/Driver.mli index c588a5ade..e555620be 100644 --- a/infer/src/integration/Driver.mli +++ b/infer/src/integration/Driver.mli @@ -22,9 +22,8 @@ type mode = | Maven of string * string list | PythonCapture of Config.build_system * string list | XcodeXcpretty of string * string list -[@@deriving compare] -val equal_mode : mode -> mode -> bool +val is_analyze_mode : mode -> bool val mode_from_command_line : mode Lazy.t (** driver mode computed from the command-line arguments and settings in Config *)