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/PrintPreprocessedOutput.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/PrintPreprocessedOutput.cpp')
-rw-r--r-- | lib/Frontend/PrintPreprocessedOutput.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Frontend/PrintPreprocessedOutput.cpp b/lib/Frontend/PrintPreprocessedOutput.cpp index 44e0e13906..02afd24c24 100644 --- a/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/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 |