aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-05-13 06:10:29 +0000
committerChris Lattner <sabre@nondot.org>2009-05-13 06:10:29 +0000
commit766703b76dc1eb0c49d11cafc2a17c7407876ebc (patch)
treeefc58e9f621da896a8024f726e167447110fddbf
parent6fd34f9a26fcb9657966b77bd39614033f3fd881 (diff)
Fix rdar://6880630 - # in _Pragma does not start a preprocessor directive.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71643 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Lex/Lexer.cpp4
-rw-r--r--test/Preprocessor/_Pragma.c8
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp
index 3f78be68c1..c2ffd6d433 100644
--- a/lib/Lex/Lexer.cpp
+++ b/lib/Lex/Lexer.cpp
@@ -1631,7 +1631,7 @@ LexNextToken:
// it's actually the start of a preprocessing directive. Callback to
// the preprocessor to handle it.
// FIXME: -fpreprocessed mode??
- if (Result.isAtStartOfLine() && !LexingRawMode) {
+ if (Result.isAtStartOfLine() && !LexingRawMode && !Is_PragmaLexer) {
FormTokenWithChars(Result, CurPtr, tok::hash);
PP->HandleDirective(Result);
@@ -1762,7 +1762,7 @@ LexNextToken:
// it's actually the start of a preprocessing directive. Callback to
// the preprocessor to handle it.
// FIXME: -fpreprocessed mode??
- if (Result.isAtStartOfLine() && !LexingRawMode) {
+ if (Result.isAtStartOfLine() && !LexingRawMode && !Is_PragmaLexer) {
FormTokenWithChars(Result, CurPtr, tok::hash);
PP->HandleDirective(Result);
diff --git a/test/Preprocessor/_Pragma.c b/test/Preprocessor/_Pragma.c
index d449dc08b6..9c0c97d1f0 100644
--- a/test/Preprocessor/_Pragma.c
+++ b/test/Preprocessor/_Pragma.c
@@ -1,4 +1,10 @@
-// RUN: clang-cc %s -E -verify
+// RUN: clang-cc %s -verify -Wall
_Pragma ("GCC system_header") // expected-warning {{system_header ignored in main file}}
+// rdar://6880630
+_Pragma("#define macro") // expected-warning {{unknown pragma ignored}}
+
+#ifdef macro
+#error #define invalid
+#endif