From c67a5f9038188c9361efe76f44e77746f94e309c Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Thu, 12 Nov 2009 02:53:34 +0000 Subject: [PATCH] Simplify. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86938 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/clang-cc/clang-cc.cpp | 40 +++++++++---------------------------- 1 file changed, 9 insertions(+), 31 deletions(-) diff --git a/tools/clang-cc/clang-cc.cpp b/tools/clang-cc/clang-cc.cpp index 0d056c046e..403eddb195 100644 --- a/tools/clang-cc/clang-cc.cpp +++ b/tools/clang-cc/clang-cc.cpp @@ -821,12 +821,12 @@ static void ProcessInputFile(const CompilerInvocation &CompOpts, 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 @@ static void ProcessInputFile(const CompilerInvocation &CompOpts, 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 @@ static void ProcessInputFile(const CompilerInvocation &CompOpts, 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(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) -- 2.50.1