diff options
| author | Chris Lattner <sabre@nondot.org> | 2009-03-25 21:08:24 +0000 | 
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2009-03-25 21:08:24 +0000 | 
| commit | 51a53f92a57a9bd163156ade91221f056f510110 (patch) | |
| tree | cf84d27597a6aa835bca0bc9fa35f2087dc85d11 /clang/lib/Lex | |
| parent | beb9055000f7ca7ed8910c1648580734a41cc94c (diff) | |
| download | bcm5719-llvm-51a53f92a57a9bd163156ade91221f056f510110.tar.gz bcm5719-llvm-51a53f92a57a9bd163156ade91221f056f510110.zip | |
fix PR3880, fixing a comma swallowing bug handling macros that only take
... arguments.
llvm-svn: 67706
Diffstat (limited to 'clang/lib/Lex')
| -rw-r--r-- | clang/lib/Lex/PPMacroExpansion.cpp | 6 | 
1 files changed, 6 insertions, 0 deletions
| diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp index 6ec306196db..f1c69d99341 100644 --- a/clang/lib/Lex/PPMacroExpansion.cpp +++ b/clang/lib/Lex/PPMacroExpansion.cpp @@ -403,6 +403,12 @@ MacroArgs *Preprocessor::ReadFunctionLikeMacroArgs(Token &MacroName,      Tok.setLocation(EndLoc);      Tok.setLength(0);      ArgTokens.push_back(Tok); +  } else if (NumActuals == 1 && ArgTokens.size() == 1) { +    // If there is exactly one argument, and that argument is just an EOF token, +    // then we have an empty "()" argument empty list.  This is fine, even if +    // the macro expects one argument (the argument is just empty).  However, if +    // the macro expects "...", then we need to know that it was elided. +    isVarargsElided = MinArgsExpected == 1 && MI->isVariadic();    }    return MacroArgs::create(MI, &ArgTokens[0], ArgTokens.size(),isVarargsElided); | 

