fix PR3880, fixing a comma swallowing bug handling macros that only take
... arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67706 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp
index 6ec3061..f1c69d9 100644
--- a/lib/Lex/PPMacroExpansion.cpp
+++ b/lib/Lex/PPMacroExpansion.cpp
@@ -403,6 +403,12 @@
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);