summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/PrintPreprocessedOutput.cpp
diff options
context:
space:
mode:
authorBen Langmuir <blangmuir@apple.com>2014-09-10 21:29:41 +0000
committerBen Langmuir <blangmuir@apple.com>2014-09-10 21:29:41 +0000
commit5418f40127d5e0b1f3d26f292b786e7eabd93c6c (patch)
tree6730814fa1ba3ad63e6bccfe6c7c7e3cda403bbf /clang/lib/Frontend/PrintPreprocessedOutput.cpp
parent1109ed42450bedcc0000994414f741988034540a (diff)
downloadbcm5719-llvm-5418f40127d5e0b1f3d26f292b786e7eabd93c6c.tar.gz
bcm5719-llvm-5418f40127d5e0b1f3d26f292b786e7eabd93c6c.zip
Avoid a couple of assertions when preprocessing with modules
1. We were hitting the NextIsPrevious assertion because we were trying to merge decl chains that were independent of each other because we had no Sema object to allow them to find existing decls. This is fixed by delaying loading the "preloaded" decls until Sema is available. 2. We were trying to get identifier info from an annotation token, which asserts. The fix is to special-case the module annotations in the preprocessed output printer. Fixed in a single commit because when you hit 1 you almost invariably hit 2 as well. llvm-svn: 217550
Diffstat (limited to 'clang/lib/Frontend/PrintPreprocessedOutput.cpp')
-rw-r--r--clang/lib/Frontend/PrintPreprocessedOutput.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Frontend/PrintPreprocessedOutput.cpp b/clang/lib/Frontend/PrintPreprocessedOutput.cpp
index 17d7279e3ff..7c1d9a56883 100644
--- a/clang/lib/Frontend/PrintPreprocessedOutput.cpp
+++ b/clang/lib/Frontend/PrintPreprocessedOutput.cpp
@@ -332,7 +332,10 @@ void PrintPPOutputPPCallbacks::InclusionDirective(SourceLocation HashLoc,
MoveToLine(HashLoc);
OS << "@import " << Imported->getFullModuleName() << ";"
<< " /* clang -E: implicit import for \"" << File->getName() << "\" */";
+ // Since we want a newline after the @import, but not a #<line>, start a new
+ // line immediately.
EmittedTokensOnThisLine = true;
+ startNewLineIfNeeded();
}
}
OpenPOWER on IntegriCloud