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
diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp
index a682e86..7e695a5 100644
--- a/lib/Lex/PPMacroExpansion.cpp
+++ b/lib/Lex/PPMacroExpansion.cpp
@@ -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
diff --git a/test/Preprocessor/macro_expand.c b/test/Preprocessor/macro_expand.c
index a7a80af..c2c76bd 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))