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

Daniel Dunbar daniel at zuster.org
Wed Nov 11 18:53:34 PST 2009


Author: ddunbar
Date: Wed Nov 11 20:53:34 2009
New Revision: 86938

URL: http://llvm.org/viewvc/llvm-project?rev=86938&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=86938&r1=86937&r2=86938&view=diff

==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Wed Nov 11 20:53:34 2009
@@ -821,12 +821,12 @@
       return;
 
     // Run the preprocessor actions.
+    llvm::TimeRegion Timer(ClangFrontendTimer);
     switch (PA) {
     default:
       assert(0 && "unexpected program action");
 
     case DumpRawTokens: {
-      llvm::TimeRegion Timer(ClangFrontendTimer);
       SourceManager &SM = PP.getSourceManager();
       // Start lexing the specified input file.
       Lexer RawLex(SM.getMainFileID(), SM, PP.getLangOptions());
@@ -839,12 +839,10 @@
         fprintf(stderr, "\n");
         RawLex.LexFromRawLexer(RawTok);
       }
-      ClearSourceMgr = true;
       break;
     }
 
     case DumpTokens: {
-      llvm::TimeRegion Timer(ClangFrontendTimer);
       Token Tok;
       // Start preprocessing the specified input file.
       PP.EnterMainSourceFile();
@@ -853,66 +851,46 @@
         PP.DumpToken(Tok, true);
         fprintf(stderr, "\n");
       } while (Tok.isNot(tok::eof));
-      ClearSourceMgr = true;
       break;
     }
 
-    case GeneratePTH: {
-      llvm::TimeRegion Timer(ClangFrontendTimer);
+    case GeneratePTH:
       CacheTokens(PP, static_cast<llvm::raw_fd_ostream*>(OS.get()));
-      ClearSourceMgr = true;
       break;
-    }
 
-    case ParseNoop: {
-      llvm::TimeRegion Timer(ClangFrontendTimer);
+    case ParseNoop:
       ParseFile(PP, new MinimalAction(PP));
-      ClearSourceMgr = true;
       break;
-    }
 
-    case ParsePrintCallbacks: {
-      llvm::TimeRegion Timer(ClangFrontendTimer);
+    case ParsePrintCallbacks:
       ParseFile(PP, CreatePrintParserActionsAction(PP, OS.get()));
-      ClearSourceMgr = true;
       break;
-    }
 
-    case PrintPreprocessedInput: {
-      llvm::TimeRegion Timer(ClangFrontendTimer);
+    case PrintPreprocessedInput:
       DoPrintPreprocessedInput(PP, OS.get(),
                                CompOpts.getPreprocessorOutputOpts());
-      ClearSourceMgr = true;
       break;
-    }
 
-    case RewriteMacros: {
-      llvm::TimeRegion Timer(ClangFrontendTimer);
+    case RewriteMacros:
       RewriteMacrosInInput(PP, OS.get());
-      ClearSourceMgr = true;
       break;
-    }
 
-    case RewriteTest: {
-      llvm::TimeRegion Timer(ClangFrontendTimer);
+    case RewriteTest:
       DoRewriteTest(PP, OS.get());
-      ClearSourceMgr = true;
       break;
-    }
 
     case RunPreprocessorOnly: {    // Just lex as fast as we can, no output.
-      llvm::TimeRegion Timer(ClangFrontendTimer);
       Token Tok;
       // Start parsing the specified input file.
       PP.EnterMainSourceFile();
       do {
         PP.Lex(Tok);
       } while (Tok.isNot(tok::eof));
-      ClearSourceMgr = true;
       break;
     }
-
     }
+
+    ClearSourceMgr = true;
   }
 
   if (FixItRewrite)





More information about the cfe-commits mailing list