From 50ac3cde4148e80a1675eec2df7225603167bbbe Mon Sep 17 00:00:00 2001 From: Sam Blackshear Date: Fri, 2 Sep 2016 09:51:39 -0700 Subject: [PATCH] command-line setup Reviewed By: jberdine Differential Revision: D3744175 fbshipit-source-id: e850443 --- infer/lib/python/inferlib/analyze.py | 2 ++ infer/lib/python/inferlib/config.py | 2 ++ infer/src/backend/config.ml | 23 ++++++++++++++++------- infer/src/backend/config.mli | 3 ++- infer/src/checkers/registerCheckers.ml | 3 +-- 5 files changed, 23 insertions(+), 10 deletions(-) diff --git a/infer/lib/python/inferlib/analyze.py b/infer/lib/python/inferlib/analyze.py index 0a916456b..5ba85d7a7 100644 --- a/infer/lib/python/inferlib/analyze.py +++ b/infer/lib/python/inferlib/analyze.py @@ -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') diff --git a/infer/lib/python/inferlib/config.py b/infer/lib/python/inferlib/config.py index 0a530961c..c5e32b054 100644 --- a/infer/lib/python/inferlib/config.py +++ b/infer/lib/python/inferlib/config.py @@ -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, ] diff --git a/infer/src/backend/config.ml b/infer/src/backend/config.ml index fc2fa720c..88dce719e 100644 --- a/infer/src/backend/config.ml +++ b/infer/src/backend/config.ml @@ -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 diff --git a/infer/src/backend/config.mli b/infer/src/backend/config.mli index 0e60b59e7..76eeeaa84 100644 --- a/infer/src/backend/config.mli +++ b/infer/src/backend/config.mli @@ -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 diff --git a/infer/src/checkers/registerCheckers.ml b/infer/src/checkers/registerCheckers.ml index 9393a0acb..1424fbeee 100644 --- a/infer/src/checkers/registerCheckers.ml +++ b/infer/src/checkers/registerCheckers.ml @@ -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 =