Add --analyzer-no-default-checks and --analyzer-output options.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72238 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Driver/Options.def b/include/clang/Driver/Options.def
index 1ce9210..90258ef 100644
--- a/include/clang/Driver/Options.def
+++ b/include/clang/Driver/Options.def
@@ -129,6 +129,8 @@
OPTION("--CLASSPATH", _CLASSPATH, Separate, INVALID, fclasspath_EQ, "J", 0, 0, 0)
OPTION("--all-warnings", _all_warnings, Flag, INVALID, Wall, "", 0, 0, 0)
OPTION("--analyze-auto", _analyze_auto, Flag, INVALID, INVALID, "d", 0, 0, 0)
+OPTION("--analyzer-no-default-checks", _analyzer_no_default_checks, Flag, INVALID, INVALID, "d", 0, 0, 0)
+OPTION("--analyzer-output", _analyzer_output, JoinedOrSeparate, INVALID, INVALID, "d", 0, 0, 0)
OPTION("--analyze", _analyze, Flag, INVALID, INVALID, "d", 0,
"Run the static analyzer", 0)
OPTION("--ansi", _ansi, Flag, INVALID, ansi, "", 0, 0, 0)
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index ee6bfda..add3117 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -230,17 +230,23 @@
if (isa<AnalyzeJobAction>(JA)) {
// Add default argument set.
- //
- // FIXME: Move into clang?
- CmdArgs.push_back("-warn-dead-stores");
- CmdArgs.push_back("-checker-cfref");
- CmdArgs.push_back("-analyzer-eagerly-assume");
- CmdArgs.push_back("-warn-objc-methodsigs");
- // Do not enable the missing -dealloc check.
- // '-warn-objc-missing-dealloc',
- CmdArgs.push_back("-warn-objc-unused-ivars");
+ if (!Args.hasArg(options::OPT__analyzer_no_default_checks)) {
+ CmdArgs.push_back("-warn-dead-stores");
+ CmdArgs.push_back("-checker-cfref");
+ CmdArgs.push_back("-analyzer-eagerly-assume");
+ CmdArgs.push_back("-warn-objc-methodsigs");
+ // Do not enable the missing -dealloc check.
+ // '-warn-objc-missing-dealloc',
+ CmdArgs.push_back("-warn-objc-unused-ivars");
+ }
- CmdArgs.push_back("-analyzer-output=plist");
+ // Set the output format. The default is plist, for (lame) historical
+ // reasons.
+ CmdArgs.push_back("-analyzer-output");
+ if (Arg *A = Args.getLastArg(options::OPT__analyzer_output))
+ CmdArgs.push_back(A->getValue(Args));
+ else
+ CmdArgs.push_back("plist");
// Add -Xanalyzer arguments when running as analyzer.
Args.AddAllArgValues(CmdArgs, options::OPT_Xanalyzer);
@@ -329,8 +335,8 @@
(void) Args.hasArg(options::OPT_mtune_EQ);
if (const Arg *A = Args.getLastArg(options::OPT_march_EQ)) {
- // FIXME: We made need some translation here from the options gcc
- // takes to names the LLVM backend understand?
+ // FIXME: We may need some translation here from the options gcc takes to
+ // names the LLVM backend understand?
CmdArgs.push_back("-mcpu");
CmdArgs.push_back(A->getValue(Args));
} else {