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 | 4ad3da2843da1e8c8da6a87548ae8ec393512c23 (patch) | |
| tree | a995f0aeb35ca1d6a9d92dd4a94404032388111c /clang/lib/Frontend/FrontendActions.cpp | |
| parent | 22fde23b6e125317828d7c07b86c8e7be16440a5 (diff) | |
| download | bcm5719-llvm-4ad3da2843da1e8c8da6a87548ae8ec393512c23.tar.gz bcm5719-llvm-4ad3da2843da1e8c8da6a87548ae8ec393512c23.zip | |
Entering the main source file in the preprocessor can fail if the
source file has been changed. Handle that failure more gracefully.
llvm-svn: 98727
Diffstat (limited to 'clang/lib/Frontend/FrontendActions.cpp')
| -rw-r--r-- | clang/lib/Frontend/FrontendActions.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp index 1e210b42e6d..1077f9eb341 100644 --- a/clang/lib/Frontend/FrontendActions.cpp +++ b/clang/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(); } |

