// A("blah")
Diag(Tok, diag::ext_missing_varargs_arg);
- // Remember this occurred if this is a C99 macro invocation with at least
- // one actual argument.
- isVarargsElided = MI->isC99Varargs() && MI->getNumArgs() > 1;
+ // Remember this occurred if this is a macro invocation with at least
+ // one actual argument. This allows us to elide the comma when used for
+ // cases like:
+ // #define A(x, foo...) blah(a, ## foo)
+ // #define A(x, ...) blah(a, ## __VA_ARGS__)
+ isVarargsElided = MI->getNumArgs() > 1;
} else if (MI->getNumArgs() == 1) {
// #define A(x)
// A()
// RUN: clang -E %s | grep '^a: x$' &&
// RUN: clang -E %s | grep '^b: x y, z,h$'
+// RUN: clang -E %s | grep '^c: foo(x)$'
#define A(b, c...) b c
a: A(x)
b: A(x, y, z,h)
+#define B(b, c...) foo(b, ## c)
+c: B(x)