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/PrintPreprocessedOutput.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/PrintPreprocessedOutput.cpp')
-rw-r--r-- | clang/lib/Frontend/PrintPreprocessedOutput.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Frontend/PrintPreprocessedOutput.cpp b/clang/lib/Frontend/PrintPreprocessedOutput.cpp index 44e0e139060..02afd24c246 100644 --- a/clang/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/clang/lib/Frontend/PrintPreprocessedOutput.cpp @@ -448,7 +448,8 @@ static int MacroIDCompare(const void* a, const void* b) { static void DoPrintMacros(Preprocessor &PP, llvm::raw_ostream *OS) { // -dM mode just scans and ignores all tokens in the files, then dumps out // the macro table at the end. - PP.EnterMainSourceFile(); + if (PP.EnterMainSourceFile()) + return; Token Tok; do PP.Lex(Tok); @@ -495,7 +496,8 @@ void clang::DoPrintPreprocessedInput(Preprocessor &PP, llvm::raw_ostream *OS, PP.addPPCallbacks(Callbacks); // After we have configured the preprocessor, enter the main file. - PP.EnterMainSourceFile(); + if (PP.EnterMainSourceFile()) + return; // Consume all of the tokens that come from the predefines buffer. Those // should not be emitted into the output and are guaranteed to be at the |