aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-18 06:44:18 +0000
committerChris Lattner <sabre@nondot.org>2009-04-18 06:44:18 +0000
commit5c497a80c60061ba5bc3d8bd1518c15b7d7556dd (patch)
tree50016f355ab0d9e2be357b59144d7bc046e404e3
parentbc81682756a2406e1788b14c576b3c8b515d97a3 (diff)
fix PR3927 by being more careful about the pp test for identifier.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69423 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Lex/PPMacroExpansion.cpp2
-rw-r--r--test/Preprocessor/macro_expand.c13
2 files changed, 12 insertions, 3 deletions
diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp
index a682e86d14..7e695a542b 100644
--- a/lib/Lex/PPMacroExpansion.cpp
+++ b/lib/Lex/PPMacroExpansion.cpp
@@ -335,7 +335,7 @@ MacroArgs *Preprocessor::ReadFunctionLikeMacroArgs(Token &MacroName,
// 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
diff --git a/test/Preprocessor/macro_expand.c b/test/Preprocessor/macro_expand.c
index a7a80aff42..c2c76bddbf 100644
--- a/test/Preprocessor/macro_expand.c
+++ b/test/Preprocessor/macro_expand.c
@@ -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))