[cfe-commits] r71643 - in /cfe/trunk: lib/Lex/Lexer.cpp test/Preprocessor/_Pragma.c

Chris Lattner sabre at nondot.org
Tue May 12 23:10:29 PDT 2009


Author: lattner
Date: Wed May 13 01:10:29 2009
New Revision: 71643

URL: http://llvm.org/viewvc/llvm-project?rev=71643&view=rev
Log:
Fix rdar://6880630 - # in _Pragma does not start a preprocessor directive.


Modified:
    cfe/trunk/lib/Lex/Lexer.cpp
    cfe/trunk/test/Preprocessor/_Pragma.c

Modified: cfe/trunk/lib/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Lexer.cpp?rev=71643&r1=71642&r2=71643&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/Lexer.cpp (original)
+++ cfe/trunk/lib/Lex/Lexer.cpp Wed May 13 01:10:29 2009
@@ -1631,7 +1631,7 @@
         // 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 @@
       // 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);
         

Modified: cfe/trunk/test/Preprocessor/_Pragma.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/_Pragma.c?rev=71643&r1=71642&r2=71643&view=diff

==============================================================================
--- cfe/trunk/test/Preprocessor/_Pragma.c (original)
+++ cfe/trunk/test/Preprocessor/_Pragma.c Wed May 13 01:10:29 2009
@@ -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





More information about the cfe-commits mailing list