summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/PrintPreprocessedOutput.cpp
diff options
context:
space:
mode:
authorBen Langmuir <blangmuir@apple.com>2014-01-30 18:09:55 +0000
committerBen Langmuir <blangmuir@apple.com>2014-01-30 18:09:55 +0000
commit5944ecd64c6863ab278425c39149014993ef5c4d (patch)
tree1fe028c00f91f5b5bf6666d7710158478ca1d04f /clang/lib/Frontend/PrintPreprocessedOutput.cpp
parenta1f31460d8266bd9b5b9890af375646fff18c0e9 (diff)
downloadbcm5719-llvm-5944ecd64c6863ab278425c39149014993ef5c4d.tar.gz
bcm5719-llvm-5944ecd64c6863ab278425c39149014993ef5c4d.zip
Fix assertion failures on annot_* tokens in clang -E
In particular, #pragma clang __debug, and #include implicitly changed into @import were causing assertion failures. llvm-svn: 200475
Diffstat (limited to 'clang/lib/Frontend/PrintPreprocessedOutput.cpp')
-rw-r--r--clang/lib/Frontend/PrintPreprocessedOutput.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/clang/lib/Frontend/PrintPreprocessedOutput.cpp b/clang/lib/Frontend/PrintPreprocessedOutput.cpp
index f3393bfe51c..834e5262c63 100644
--- a/clang/lib/Frontend/PrintPreprocessedOutput.cpp
+++ b/clang/lib/Frontend/PrintPreprocessedOutput.cpp
@@ -342,6 +342,7 @@ void PrintPPOutputPPCallbacks::InclusionDirective(SourceLocation HashLoc,
OS << "@import " << Imported->getFullModuleName() << ";"
<< " /* clang -E: implicit import for \"" << File->getName() << "\" */";
EmittedTokensOnThisLine = true;
+ setEmittedDirectiveOnThisLine();
}
}
@@ -657,11 +658,9 @@ static void PrintPreprocessedTokens(Preprocessor &PP, Token &Tok,
// -traditional-cpp the lexer keeps /all/ whitespace, including comments.
SourceLocation StartLoc = Tok.getLocation();
Callbacks->MoveToLine(StartLoc.getLocWithOffset(Tok.getLength()));
- } else if (Tok.is(tok::annot_module_include) ||
- Tok.is(tok::annot_module_begin) ||
- Tok.is(tok::annot_module_end)) {
- // PrintPPOutputPPCallbacks::InclusionDirective handles producing
- // appropriate output here. Ignore this token entirely.
+ } else if (Tok.isAnnotation()) {
+ // PrintPPOutputPPCallbacks handles producing appropriate output here.
+ // Ignore this token entirely.
PP.Lex(Tok);
continue;
} else if (IdentifierInfo *II = Tok.getIdentifierInfo()) {
OpenPOWER on IntegriCloud