summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/PrintPreprocessedOutput.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2016-02-09 08:51:26 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2016-02-09 08:51:26 +0000
commit6ee07eab0311ac9096a9d1a38a44a0f069c5113e (patch)
treefb08efaca39a1483bcf162a62504644cb5ae03f5 /clang/lib/Frontend/PrintPreprocessedOutput.cpp
parent7e671e06a2340c3dc6085a523ac26afc0d9b8234 (diff)
downloadbcm5719-llvm-6ee07eab0311ac9096a9d1a38a44a0f069c5113e.tar.gz
bcm5719-llvm-6ee07eab0311ac9096a9d1a38a44a0f069c5113e.zip
Fixed preprocessed output of the first token for pragmas.
Clang did not expanded macros in the very first token of the pragmas during preprocessed output llvm-svn: 260211
Diffstat (limited to 'clang/lib/Frontend/PrintPreprocessedOutput.cpp')
-rw-r--r--clang/lib/Frontend/PrintPreprocessedOutput.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Frontend/PrintPreprocessedOutput.cpp b/clang/lib/Frontend/PrintPreprocessedOutput.cpp
index a58c935620a..c57a736d1b0 100644
--- a/clang/lib/Frontend/PrintPreprocessedOutput.cpp
+++ b/clang/lib/Frontend/PrintPreprocessedOutput.cpp
@@ -573,6 +573,15 @@ struct UnknownPragmaHandler : public PragmaHandler {
Token &PragmaTok) override {
// Figure out what line we went to and insert the appropriate number of
// newline characters.
+ if (ShouldExpandTokens) {
+ // The first token does not have expanded macros. Expand them, if
+ // required.
+ Token Toks[] = {PragmaTok};
+ PP.EnterTokenStream(Toks, llvm::array_lengthof(Toks),
+ /*DisableMacroExpansion=*/false,
+ /*OwnsTokens=*/false);
+ PP.Lex(PragmaTok);
+ }
Callbacks->startNewLineIfNeeded();
Callbacks->MoveToLine(PragmaTok.getLocation());
Callbacks->OS.write(Prefix, strlen(Prefix));
OpenPOWER on IntegriCloud