From 5c497a80c60061ba5bc3d8bd1518c15b7d7556dd Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 18 Apr 2009 06:44:18 +0000 Subject: [PATCH] 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 --- lib/Lex/PPMacroExpansion.cpp | 2 +- test/Preprocessor/macro_expand.c | 13 +++++++++++-- 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)) -- 2.50.1