[cfe-commits] r89388 - in /cfe/trunk: include/clang/Frontend/AnalysisConsumer.h include/clang/Frontend/FrontendOptions.h lib/Driver/CC1Options.cpp lib/Frontend/CompilerInvocation.cpp tools/driver/cc1_main.cpp

Daniel Dunbar daniel at zuster.org
Thu Nov 19 12:54:59 PST 2009


Author: ddunbar
Date: Thu Nov 19 14:54:59 2009
New Revision: 89388

URL: http://llvm.org/viewvc/llvm-project?rev=89388&view=rev
Log:
Fix some default in the option classes, and some CompilerInvocation argification
errors.

Modified:
    cfe/trunk/include/clang/Frontend/AnalysisConsumer.h
    cfe/trunk/include/clang/Frontend/FrontendOptions.h
    cfe/trunk/lib/Driver/CC1Options.cpp
    cfe/trunk/lib/Frontend/CompilerInvocation.cpp
    cfe/trunk/tools/driver/cc1_main.cpp

Modified: cfe/trunk/include/clang/Frontend/AnalysisConsumer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/AnalysisConsumer.h?rev=89388&r1=89387&r2=89388&view=diff

==============================================================================
--- cfe/trunk/include/clang/Frontend/AnalysisConsumer.h (original)
+++ cfe/trunk/include/clang/Frontend/AnalysisConsumer.h Thu Nov 19 14:54:59 2009
@@ -77,7 +77,7 @@
     AnalyzeAll = 0;
     AnalyzerDisplayProgress = 0;
     EagerlyAssume = 0;
-    PurgeDead = 0;
+    PurgeDead = 1;
     TrimGraph = 0;
     VisualizeEGDot = 0;
     VisualizeEGUbi = 0;

Modified: cfe/trunk/include/clang/Frontend/FrontendOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/FrontendOptions.h?rev=89388&r1=89387&r2=89388&view=diff

==============================================================================
--- cfe/trunk/include/clang/Frontend/FrontendOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/FrontendOptions.h Thu Nov 19 14:54:59 2009
@@ -107,7 +107,7 @@
 
 public:
   FrontendOptions() {
-    DebugCodeCompletionPrinter = 0;
+    DebugCodeCompletionPrinter = 1;
     DisableFree = 0;
     EmptyInputOnly = 0;
     ProgramAction = frontend::ParseSyntaxOnly;

Modified: cfe/trunk/lib/Driver/CC1Options.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/CC1Options.cpp?rev=89388&r1=89387&r2=89388&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/CC1Options.cpp (original)
+++ cfe/trunk/lib/Driver/CC1Options.cpp Thu Nov 19 14:54:59 2009
@@ -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 @@
 OptTable *clang::driver::createCC1OptTable() {
   return new CC1OptTable();
 }
+
+//
+
+using namespace clang;
+
+void CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,
+                           const llvm::SmallVectorImpl<llvm::StringRef> &Args) {
+}

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=89388&r1=89387&r2=89388&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu Nov 19 14:54:59 2009
@@ -12,10 +12,6 @@
 #include "llvm/Support/ErrorHandling.h"
 using namespace clang;
 
-void CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,
-                           const llvm::SmallVectorImpl<llvm::StringRef> &Args) {
-}
-
 static const char *getAnalysisName(Analyses Kind) {
   switch (Kind) {
   default:
@@ -112,8 +108,8 @@
   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 @@
     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 @@
   }
   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 @@
   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!");

Modified: cfe/trunk/tools/driver/cc1_main.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1_main.cpp?rev=89388&r1=89387&r2=89388&view=diff

==============================================================================
--- cfe/trunk/tools/driver/cc1_main.cpp (original)
+++ cfe/trunk/tools/driver/cc1_main.cpp Thu Nov 19 14:54:59 2009
@@ -60,7 +60,7 @@
 
   // Dump the converted arguments.
   llvm::SmallVector<llvm::StringRef, 32> 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 @@
   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<std::string> 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";





More information about the cfe-commits mailing list