diff options
-rw-r--r-- | include/clang/Driver/Options.def | 2 | ||||
-rw-r--r-- | lib/Driver/Tools.cpp | 32 |
2 files changed, 21 insertions, 13 deletions
diff --git a/include/clang/Driver/Options.def b/include/clang/Driver/Options.def index 1ce92101d6..90258ef77e 100644 --- a/include/clang/Driver/Options.def +++ b/include/clang/Driver/Options.def @@ -129,6 +129,8 @@ OPTION("--CLASSPATH=", _CLASSPATH_EQ, Joined, INVALID, fclasspath_EQ, "", 0, 0, 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 ee6bfdaddf..add3117a18 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -230,17 +230,23 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, 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"); - - CmdArgs.push_back("-analyzer-output=plist"); + 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"); + } + + // 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 Clang::ConstructJob(Compilation &C, const JobAction &JA, (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 { |