diff options
author | David Majnemer <david.majnemer@gmail.com> | 2013-11-05 09:30:17 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2013-11-05 09:30:17 +0000 |
commit | 76faf1f52568b5356ef151cc7e13aeca3fff6291 (patch) | |
tree | 62e15b9c1d5cecec05ffe8c9a3004a25eaf60514 /clang/lib | |
parent | 04a0e5050f89419a4128753b89a0818be8b8c1cd (diff) | |
download | bcm5719-llvm-76faf1f52568b5356ef151cc7e13aeca3fff6291.tar.gz bcm5719-llvm-76faf1f52568b5356ef151cc7e13aeca3fff6291.zip |
Lex: Require that '#' be followed by a macro parameter name when preceded by '##'
After lexing a '##', we would look ahead and check to see if it was
followed by '__VA_ARGS__'. After doing so, we would then go ahead and
lex the token.
However we would fail in the case where the '##' was followed by a '#'
followed by an identifier because we would have lexed the '#' separately
from the identifier, bypassing our parameter validation logic.
Instead, lex the tokens coming after the '##' later.
This fixes PR17804.
llvm-svn: 194059
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index a952b2ef1b9..9ba65a57a84 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -2005,13 +2005,8 @@ void Preprocessor::HandleDefineDirective(Token &DefineTok, MI->getReplacementToken(NumTokens-1).is(tok::comma)) MI->setHasCommaPasting(); - // Things look ok, add the '##' and param name tokens to the macro. + // Things look ok, add the '##' token to the macro. MI->AddTokenToBody(LastTok); - MI->AddTokenToBody(Tok); - LastTok = Tok; - - // Get the next token of the macro. - LexUnexpandedToken(Tok); continue; } |