[cfe-commits] r86830 - /cfe/trunk/tools/clang-cc/clang-cc.cpp

Daniel Dunbar daniel at zuster.org
Wed Nov 11 02:22:49 PST 2009


Author: ddunbar
Date: Wed Nov 11 04:22:48 2009
New Revision: 86830

URL: http://llvm.org/viewvc/llvm-project?rev=86830&view=rev
Log:
Simplify.

Modified:
    cfe/trunk/tools/clang-cc/clang-cc.cpp

Modified: cfe/trunk/tools/clang-cc/clang-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang-cc.cpp?rev=86830&r1=86829&r2=86830&view=diff

==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Wed Nov 11 04:22:48 2009
@@ -633,6 +633,7 @@
     return CreateBlockRewriter(InFile, PP.getDiagnostics(),
                                PP.getLangOptions());
 
+  case FixIt: // We add the rewriter later.
   case ParseSyntaxOnly:
     return new ASTConsumer();
 
@@ -766,23 +767,15 @@
     DoRewriteTest(PP, OS.get());
     ClearSourceMgr = true;
     break;
+  }
 
-  case FixIt:
-    Consumer.reset(new ASTConsumer());
+  // Check if we want a fix-it rewriter.
+  if (PA == FixIt || !FixItAtLocations.empty()) {
     FixItRewrite = new FixItRewriter(PP.getDiagnostics(),
                                      PP.getSourceManager(),
                                      PP.getLangOptions());
-    break;
-  }
-
-  if (FixItAtLocations.size() > 0) {
-    // Even without the "-fixit" flag, we may have some specific locations where
-    // the user has requested fixes. Process those locations now.
-    if (!FixItRewrite)
-      FixItRewrite = new FixItRewriter(PP.getDiagnostics(),
-                                       PP.getSourceManager(),
-                                       PP.getLangOptions());
-    if (!AddFixItLocations(FixItRewrite, PP.getFileManager())) {
+    if (!FixItAtLocations.empty() &&
+        !AddFixItLocations(FixItRewrite, PP.getFileManager())) {
       // All of the fix-it locations were bad. Don't fix anything.
       delete FixItRewrite;
       FixItRewrite = 0;





More information about the cfe-commits mailing list