command-line setup

Reviewed By: jberdine

Differential Revision: D3744175

fbshipit-source-id: e850443
master
Sam Blackshear 8 years ago committed by Facebook Github Bot 8
parent 20c33f15c9
commit 50ac3cde41

@ -306,6 +306,8 @@ class AnalyzerWrapper(object):
infer_options += ['-crashcontext']
elif self.args.analyzer == config.ANALYZER_CHECKERS:
infer_options += ['-checkers']
elif self.args.analyzer == config.ANALYZER_QUANDARY:
infer_options += ['-quandary']
else:
if self.args.analyzer == config.ANALYZER_TRACING:
infer_options.append('-tracing')

@ -70,6 +70,7 @@ ANALYZER_COMPILE = 'compile'
ANALYZER_TRACING = 'tracing'
ANALYZER_CRASHCONTEXT = 'crashcontext'
ANALYZER_LINTERS = 'linters'
ANALYZER_QUANDARY = 'quandary'
ANALYZERS = [
ANALYZER_CAPTURE,
@ -80,4 +81,5 @@ ANALYZERS = [
ANALYZER_INFER,
ANALYZER_LINTERS,
ANALYZER_TRACING,
ANALYZER_QUANDARY,
]

@ -18,12 +18,13 @@ module F = Format
type analyzer = Capture | Compile | Infer | Eradicate | Checkers | Tracing
| Crashcontext | Linters
| Crashcontext | Linters | Quandary
let string_to_analyzer =
[("capture", Capture); ("compile", Compile);
("infer", Infer); ("eradicate", Eradicate); ("checkers", Checkers);
("tracing", Tracing); ("crashcontext", Crashcontext); ("linters", Linters)]
("tracing", Tracing); ("crashcontext", Crashcontext); ("linters", Linters);
("quandary", Quandary);]
type clang_lang = C | CPP | OBJC | OBJCPP
@ -522,11 +523,12 @@ and analyzer =
let () = match Infer with
(* NOTE: if compilation fails here, it means you have added a new analyzer without updating the
documentation of this option *)
| Capture | Compile | Infer | Eradicate | Checkers | Tracing | Crashcontext | Linters -> () in
| Capture | Compile | Infer | Eradicate | Checkers | Tracing | Crashcontext | Linters
| Quandary -> () in
CLOpt.mk_symbol_opt ~deprecated:["analyzer"] ~long:"analyzer" ~short:"a"
~exes:CLOpt.[Toplevel]
"Specify which analyzer to run (only one at a time is supported):\n\
- infer, eradicate, checkers: run the specified analysis\n\
- infer, eradicate, checkers, quandary: run the specified analysis\n\
- capture: run capture phase only (no analysis)\n\
- compile: run compilation command without interfering (Java only)\n\
- crashcontext, tracing: experimental (see --crashcontext and --tracing)\n\
@ -699,7 +701,7 @@ and enable_checks =
CLOpt.mk_string_list ~deprecated:["enable_checks"] ~long:"enable-checks" ~meta:"error name"
"Show reports coming from this type of errors"
and checkers, eradicate, crashcontext =
and checkers, eradicate, crashcontext, quandary =
(* Run only the checkers instead of the full analysis *)
let checkers =
CLOpt.mk_bool ~deprecated:["checkers"] ~long:"checkers"
@ -717,7 +719,13 @@ and checkers, eradicate, crashcontext =
""
[checkers]
in
(checkers, eradicate, crashcontext)
(* Activate the quandary taint analysis *)
let quandary =
CLOpt.mk_bool_group ~deprecated:["quandary"] ~long:"quandary"
""
[checkers]
in
(checkers, eradicate, crashcontext, quandary)
(* Use file for the err channel *)
and err_file =
@ -1335,7 +1343,7 @@ and calls_csv = !calls_csv
and checkers = !checkers
(** should the checkers be run? *)
and checkers_enabled = not (!eradicate || !crashcontext)
and checkers_enabled = not (!eradicate || !crashcontext || !quandary)
and clang_include_to_override = !clang_include_to_override
and clang_lang = !clang_lang
and cluster_cmdline = !cluster
@ -1395,6 +1403,7 @@ and print_types = !print_types
and print_using_diff = !print_using_diff
and procs_csv = !procs_csv
and procs_xml = !procs_xml
and quandary = !quandary
and quiet = !quiet
and reactive_mode = !reactive
and report = !report

@ -16,7 +16,7 @@ open! Utils
(** Various kind of analyzers *)
type analyzer = Capture | Compile | Infer | Eradicate | Checkers | Tracing
| Crashcontext | Linters
| Crashcontext | Linters | Quandary
(** Association list of analyzers and their names *)
val string_to_analyzer : (string * analyzer) list
@ -220,6 +220,7 @@ val print_using_diff : bool
val procs_csv : outfile option
val procs_xml : outfile option
val project_root : string option
val quandary : bool
val quiet : bool
val reactive_mode : bool
val report : outfile option

@ -33,13 +33,12 @@ let active_procedure_checkers () =
SqlChecker.callback_sql, false;
Eradicate.callback_eradicate, Config.eradicate;
BoundedCallTree.checker, Config.crashcontext;
TaintAnalysis.Java.checker, false;
TaintAnalysis.Java.checker, Config.quandary;
Checkers.callback_check_field_access, false;
ImmutableChecker.callback_check_immutable_cast, checkers_enabled;
RepeatedCallsChecker.callback_check_repeated_calls, checkers_enabled;
PrintfArgs.callback_printf_args, checkers_enabled;
AnnotationReachability.Interprocedural.check_and_report, checkers_enabled;
Checkers.callback_print_access_to_globals, false;
] in
IList.map (fun (x, y) -> (x, y, Some Config.Java)) l in
let c_cpp_checkers =

Loading…
Cancel
Save