[cfe-commits] r69423 - in /cfe/trunk: lib/Lex/PPMacroExpansion.cpp test/Preprocessor/macro_expand.c

Chris Lattner sabre at nondot.org
Fri Apr 17 23:44:18 PDT 2009


Author: lattner
Date: Sat Apr 18 01:44:18 2009
New Revision: 69423

URL: http://llvm.org/viewvc/llvm-project?rev=69423&view=rev
Log:
fix PR3927 by being more careful about the pp test for identifier.

Modified:
    cfe/trunk/lib/Lex/PPMacroExpansion.cpp
    cfe/trunk/test/Preprocessor/macro_expand.c

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

==============================================================================
--- cfe/trunk/lib/Lex/PPMacroExpansion.cpp (original)
+++ cfe/trunk/lib/Lex/PPMacroExpansion.cpp Sat Apr 18 01:44:18 2009
@@ -335,7 +335,7 @@
         // If this is a comment token in the argument list and we're just in
         // -C mode (not -CC mode), discard the comment.
         continue;
-      } else if (Tok.is(tok::identifier)) {
+      } else if (Tok.getIdentifierInfo() != 0) {
         // Reading macro arguments can cause macros that we are currently
         // expanding from to be popped off the expansion stack.  Doing so causes
         // them to be reenabled for expansion.  Here we record whether any

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

==============================================================================
--- cfe/trunk/test/Preprocessor/macro_expand.c (original)
+++ cfe/trunk/test/Preprocessor/macro_expand.c Sat Apr 18 01:44:18 2009
@@ -1,7 +1,16 @@
-// RUN: clang-cc -E %s | grep '^Y$'
+// RUN: clang-cc -E %s | grep '^A: Y$' &&
+// RUN: clang-cc -E %s | grep '^B: f()$' &&
+// RUN: clang-cc -E %s | grep '^C: for()$'
 
 #define X() Y
 #define Y() X
 
-X()()()
+A: X()()()
+
+// PR3927
+#define f(x) h(x
+#define for(x) h(x
+#define h(x) x()
+B: f(f))
+C: for(for))
 





More information about the cfe-commits mailing list