diff options
-rw-r--r-- | lib/Frontend/PrintPreprocessedOutput.cpp | 5 | ||||
-rw-r--r-- | lib/Lex/Pragma.cpp | 4 | ||||
-rw-r--r-- | test/Preprocessor/pragma.c | 8 |
3 files changed, 13 insertions, 4 deletions
diff --git a/lib/Frontend/PrintPreprocessedOutput.cpp b/lib/Frontend/PrintPreprocessedOutput.cpp index 69cd072ea5..3b835985a5 100644 --- a/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/lib/Frontend/PrintPreprocessedOutput.cpp @@ -750,6 +750,11 @@ static void PrintPreprocessedTokens(Preprocessor &PP, Token &Tok, reinterpret_cast<Module *>(Tok.getAnnotationValue())); PP.Lex(Tok); continue; + } else if (Tok.isAnnotation()) { + // Ignore annotation tokens created by pragmas - the pragmas themselves + // will be reproduced in the preprocessed output. + PP.Lex(Tok); + continue; } else if (IdentifierInfo *II = Tok.getIdentifierInfo()) { OS << II->getName(); } else if (Tok.isLiteral() && !Tok.needsCleaning() && diff --git a/lib/Lex/Pragma.cpp b/lib/Lex/Pragma.cpp index 0a63ed724c..e58378f6ab 100644 --- a/lib/Lex/Pragma.cpp +++ b/lib/Lex/Pragma.cpp @@ -1130,10 +1130,6 @@ struct PragmaDebugHandler : public PragmaHandler { } void HandleCaptured(Preprocessor &PP) { - // Skip if emitting preprocessed output. - if (PP.isPreprocessedOutput()) - return; - Token Tok; PP.LexUnexpandedToken(Tok); diff --git a/test/Preprocessor/pragma.c b/test/Preprocessor/pragma.c new file mode 100644 index 0000000000..b491632403 --- /dev/null +++ b/test/Preprocessor/pragma.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -E %s | FileCheck %s + +#pragma clang __debug parser_crash +#pragma clang __debug dump Test + +// CHECK: #pragma clang __debug parser_crash +// FIXME: The dump parameter is dropped. +// CHECK: #pragma clang __debug dump{{$}} |