[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
master
Jules Villard 5 years ago committed by Facebook Github Bot
parent 73029bbf2e
commit f98045a9a8

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

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

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

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

Loading…
Cancel
Save