[cfe-commits] r38791 - in /cfe/cfe/trunk/Lex: MacroExpander.cpp Preprocessor.cpp
sabre at cs.uiuc.edu
sabre at cs.uiuc.edu
Wed Jul 11 09:24:40 PDT 2007
Author: sabre
Date: Wed Jul 11 11:24:39 2007
New Revision: 38791
URL: http://llvm.org/viewvc/llvm-project?rev=38791&view=rev
Log:
Implement support for #__VA_ARGS__
Modified:
cfe/cfe/trunk/Lex/MacroExpander.cpp
cfe/cfe/trunk/Lex/Preprocessor.cpp
Modified: cfe/cfe/trunk/Lex/MacroExpander.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Lex/MacroExpander.cpp?rev=38791&r1=38790&r2=38791&view=diff
==============================================================================
--- cfe/cfe/trunk/Lex/MacroExpander.cpp (original)
+++ cfe/cfe/trunk/Lex/MacroExpander.cpp Wed Jul 11 11:24:39 2007
@@ -307,7 +307,13 @@
const LexerToken &CurTok = MacroTokens[i];
if (CurTok.getKind() == tok::hash || CurTok.getKind() == tok::hashat) {
int ArgNo = Macro->getArgumentNum(MacroTokens[i+1].getIdentifierInfo());
- assert(ArgNo != -1 && "Token following # is not an argument?");
+ if (ArgNo == -1) {
+ // Otherwise, this must be #__VA_ARGS__.
+ assert(MacroTokens[i+1].getIdentifierInfo() ==
+ PP.get__VA_ARGS__Identifier() &&
+ "Token following # is not an argument?");
+ ArgNo = Macro->getNumArgs();
+ }
LexerToken Res;
if (CurTok.getKind() == tok::hash) // Stringify
Modified: cfe/cfe/trunk/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Lex/Preprocessor.cpp?rev=38791&r1=38790&r2=38791&view=diff
==============================================================================
--- cfe/cfe/trunk/Lex/Preprocessor.cpp (original)
+++ cfe/cfe/trunk/Lex/Preprocessor.cpp Wed Jul 11 11:24:39 2007
@@ -1781,7 +1781,8 @@
// Not a macro arg identifier?
if (!Tok.getIdentifierInfo() ||
- MI->getArgumentNum(Tok.getIdentifierInfo()) == -1) {
+ (MI->getArgumentNum(Tok.getIdentifierInfo()) == -1 &&
+ Tok.getIdentifierInfo() != Ident__VA_ARGS__)) {
Diag(Tok, diag::err_pp_stringize_not_parameter);
delete MI;
More information about the cfe-commits
mailing list