From: Daniel Dunbar Date: Thu, 19 Nov 2009 20:54:59 +0000 (+0000) Subject: Fix some default in the option classes, and some CompilerInvocation argification X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1be3b3bd5c983e3fc5b78db155632d2d2d6aa968;p=clang Fix some default in the option classes, and some CompilerInvocation argification errors. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89388 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Frontend/AnalysisConsumer.h b/include/clang/Frontend/AnalysisConsumer.h index 7a324331ec..24fed6e76a 100644 --- a/include/clang/Frontend/AnalysisConsumer.h +++ b/include/clang/Frontend/AnalysisConsumer.h @@ -77,7 +77,7 @@ public: AnalyzeAll = 0; AnalyzerDisplayProgress = 0; EagerlyAssume = 0; - PurgeDead = 0; + PurgeDead = 1; TrimGraph = 0; VisualizeEGDot = 0; VisualizeEGUbi = 0; diff --git a/include/clang/Frontend/FrontendOptions.h b/include/clang/Frontend/FrontendOptions.h index 197a2a05e5..c1ec8e70f1 100644 --- a/include/clang/Frontend/FrontendOptions.h +++ b/include/clang/Frontend/FrontendOptions.h @@ -107,7 +107,7 @@ public: public: FrontendOptions() { - DebugCodeCompletionPrinter = 0; + DebugCodeCompletionPrinter = 1; DisableFree = 0; EmptyInputOnly = 0; ProgramAction = frontend::ParseSyntaxOnly; diff --git a/lib/Driver/CC1Options.cpp b/lib/Driver/CC1Options.cpp index 0398dd57fb..45ec1ab6a0 100644 --- a/lib/Driver/CC1Options.cpp +++ b/lib/Driver/CC1Options.cpp @@ -10,6 +10,8 @@ #include "clang/Driver/CC1Options.h" #include "clang/Driver/OptTable.h" #include "clang/Driver/Option.h" +#include "clang/Frontend/CompilerInvocation.h" +#include "llvm/ADT/SmallVector.h" using namespace clang::driver; using namespace clang::driver::options; @@ -36,3 +38,11 @@ public: OptTable *clang::driver::createCC1OptTable() { return new CC1OptTable(); } + +// + +using namespace clang; + +void CompilerInvocation::CreateFromArgs(CompilerInvocation &Res, + const llvm::SmallVectorImpl &Args) { +} diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index b4a79c6d1e..89fd70a093 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -12,10 +12,6 @@ #include "llvm/Support/ErrorHandling.h" using namespace clang; -void CompilerInvocation::CreateFromArgs(CompilerInvocation &Res, - const llvm::SmallVectorImpl &Args) { -} - static const char *getAnalysisName(Analyses Kind) { switch (Kind) { default: @@ -112,8 +108,8 @@ static void CodeGenOptsToArgs(const CodeGenOptions &Opts, if (Opts.OptimizeSize) { assert(Opts.OptimizationLevel == 2 && "Invalid options!"); Res.push_back("-Os"); - } else if (Opts.OptimizationLevel == 0) - Res.push_back("-O" + Opts.OptimizationLevel); + } else if (Opts.OptimizationLevel != 0) + Res.push_back("-O" + llvm::utostr(Opts.OptimizationLevel)); // SimplifyLibCalls is only derived. // TimePasses is only derived. // UnitAtATime is unused. @@ -391,8 +387,8 @@ static void LangOptsToArgs(const LangOptions &Opts, Res.push_back("-fno-lax-vector-conversions"); if (Opts.AltiVec) Res.push_back("-faltivec"); - Res.push_back("-fexceptions"); - Res.push_back(Opts.Exceptions ? "1" : "0"); + if (Opts.Exceptions) + Res.push_back("-fexceptions"); if (!Opts.Rtti) Res.push_back("-fno-rtti"); if (!Opts.NeXTRuntime) @@ -425,12 +421,13 @@ static void LangOptsToArgs(const LangOptions &Opts, } if (Opts.ObjCGCBitmapPrint) Res.push_back("-print-ivar-layout"); - Res.push_back("-faccess-control"); - Res.push_back(Opts.AccessControl ? "1" : "0"); - Res.push_back("-fsigned-char"); - Res.push_back(Opts.CharIsSigned ? "1" : "0"); - Res.push_back("-fshort-wchar"); - Res.push_back(Opts.ShortWChar ? "1" : "0"); + // FIXME: Don't forget to update when the default changes! + if (Opts.AccessControl) + Res.push_back("-faccess-control"); + if (!Opts.CharIsSigned) + Res.push_back("-fsigned-char=0"); + if (Opts.ShortWChar) + Res.push_back("-fshort-wchar"); if (!Opts.ElideConstructors) Res.push_back("-fno-elide-constructors"); if (Opts.getGCMode() != LangOptions::NonGC) { @@ -444,7 +441,7 @@ static void LangOptsToArgs(const LangOptions &Opts, if (Opts.getVisibilityMode() != LangOptions::Default) { Res.push_back("-fvisibility"); if (Opts.getVisibilityMode() == LangOptions::Hidden) { - Res.push_back("default"); + Res.push_back("hidden"); } else { assert(Opts.getVisibilityMode() == LangOptions::Protected && "Invalid visibility!"); diff --git a/tools/driver/cc1_main.cpp b/tools/driver/cc1_main.cpp index c5163592b4..a0bd492a10 100644 --- a/tools/driver/cc1_main.cpp +++ b/tools/driver/cc1_main.cpp @@ -60,7 +60,7 @@ int cc1_main(Diagnostic &Diags, const char **ArgBegin, const char **ArgEnd) { // Dump the converted arguments. llvm::SmallVector Invocation2Args; - llvm::errs() << "invocation argv:"; + llvm::errs() << "invocation argv :"; for (unsigned i = 0, e = InvocationArgs.size(); i != e; ++i) { Invocation2Args.push_back(InvocationArgs[i]); llvm::errs() << " \"" << InvocationArgs[i] << '"'; @@ -73,12 +73,12 @@ int cc1_main(Diagnostic &Diags, const char **ArgBegin, const char **ArgEnd) { CompilerInvocation::CreateFromArgs(Invocation2, Invocation2Args); // FIXME: Implement CompilerInvocation comparison. - if (memcmp(&Invocation, &Invocation2, sizeof(Invocation)) != 0) { - llvm::errs() << "warning: Invocations differ!\n"; + if (true) { + //llvm::errs() << "warning: Invocations differ!\n"; std::vector Invocation2Args; Invocation2.toArgs(Invocation2Args); - llvm::errs() << "invocation argv:"; + llvm::errs() << "invocation2 argv:"; for (unsigned i = 0, e = Invocation2Args.size(); i != e; ++i) llvm::errs() << " \"" << Invocation2Args[i] << '"'; llvm::errs() << "\n";