From a77a72734cf8735c9b2b81e41e7468369fec626e Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Thu, 6 May 2010 04:55:18 +0000 Subject: [PATCH] Remove a dependency on Frontend headers in the Driver library. Also saves building and passing arguments to cc1 layer when setting values to their defaults. llvm-svn: 103162 --- .../clang/Frontend/DiagnosticOptions.h | 4 ++-- clang/lib/Driver/Tools.cpp | 21 +++++++------------ 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/clang/include/clang/Frontend/DiagnosticOptions.h b/clang/include/clang/Frontend/DiagnosticOptions.h index 1da5eb4be5a8..8eb66e57da92 100644 --- a/clang/include/clang/Frontend/DiagnosticOptions.h +++ b/clang/include/clang/Frontend/DiagnosticOptions.h @@ -81,8 +81,8 @@ public: VerifyDiagnostics = 0; BinaryOutput = 0; ErrorLimit = 0; - TemplateBacktraceLimit = 0; - MacroBacktraceLimit = 0; + TemplateBacktraceLimit = DefaultTemplateBacktraceLimit; + MacroBacktraceLimit = DefaultMacroBacktraceLimit; } }; diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 6335599721f6..4622e2d2ea64 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -21,7 +21,6 @@ #include "clang/Driver/Options.h" #include "clang/Driver/ToolChain.h" #include "clang/Driver/Util.h" -#include "clang/Frontend/DiagnosticOptions.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringSwitch.h" @@ -1083,20 +1082,16 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, else CmdArgs.push_back("19"); - CmdArgs.push_back("-fmacro-backtrace-limit"); - if (Arg *A = Args.getLastArg(options::OPT_fmacro_backtrace_limit_EQ)) + if (Arg *A = Args.getLastArg(options::OPT_fmacro_backtrace_limit_EQ)) { + CmdArgs.push_back("-fmacro-backtrace-limit"); CmdArgs.push_back(A->getValue(Args)); - else - CmdArgs.push_back(Args.MakeArgString( - llvm::Twine(DiagnosticOptions::DefaultMacroBacktraceLimit))); - - CmdArgs.push_back("-ftemplate-backtrace-limit"); - if (Arg *A = Args.getLastArg(options::OPT_ftemplate_backtrace_limit_EQ)) + } + + if (Arg *A = Args.getLastArg(options::OPT_ftemplate_backtrace_limit_EQ)) { + CmdArgs.push_back("-ftemplate-backtrace-limit"); CmdArgs.push_back(A->getValue(Args)); - else - CmdArgs.push_back(Args.MakeArgString( - llvm::Twine(DiagnosticOptions::DefaultTemplateBacktraceLimit))); - + } + // Pass -fmessage-length=. CmdArgs.push_back("-fmessage-length"); if (Arg *A = Args.getLastArg(options::OPT_fmessage_length_EQ)) {