diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-03-17 15:44:30 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-03-17 15:44:30 +0000 |
commit | dbf8ee630e4c86e5150492eaf8dbceea3c718ee1 (patch) | |
tree | 62f4e996cfce0d2ba21cd732b442c1c1a74b583c /lib/Frontend/FrontendActions.cpp | |
parent | 0419a2375f16821e40ea48e5437fefe6a803f26d (diff) |
Entering the main source file in the preprocessor can fail if the
source file has been changed. Handle that failure more gracefully.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98727 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/FrontendActions.cpp')
-rw-r--r-- | lib/Frontend/FrontendActions.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Frontend/FrontendActions.cpp b/lib/Frontend/FrontendActions.cpp index 1e210b42e6..1077f9eb34 100644 --- a/lib/Frontend/FrontendActions.cpp +++ b/lib/Frontend/FrontendActions.cpp @@ -185,7 +185,8 @@ void DumpTokensAction::ExecuteAction() { Preprocessor &PP = getCompilerInstance().getPreprocessor(); // Start preprocessing the specified input file. Token Tok; - PP.EnterMainSourceFile(); + if (PP.EnterMainSourceFile()) + return; do { PP.Lex(Tok); PP.DumpToken(Tok, true); @@ -213,7 +214,8 @@ void ParseOnlyAction::ExecuteAction() { llvm::OwningPtr<Action> PA(new MinimalAction(PP)); Parser P(PP, *PA); - PP.EnterMainSourceFile(); + if (PP.EnterMainSourceFile()) + return; P.ParseTranslationUnit(); } @@ -222,7 +224,8 @@ void PreprocessOnlyAction::ExecuteAction() { Token Tok; // Start parsing the specified input file. - PP.EnterMainSourceFile(); + if (PP.EnterMainSourceFile()) + return; do { PP.Lex(Tok); } while (Tok.isNot(tok::eof)); @@ -237,7 +240,8 @@ void PrintParseAction::ExecuteAction() { llvm::OwningPtr<Action> PA(CreatePrintParserActionsAction(PP, OS)); Parser P(PP, *PA); - PP.EnterMainSourceFile(); + if (PP.EnterMainSourceFile()) + return; P.ParseTranslationUnit(); } |