two empty arguments. Also, add an assert so that this bug
manifests as an assertion failure, not a valgrind problem.
This fixes rdar://
6880648 - [cpp] crash in ArgNeedsPreexpansion
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71616
91177308-0d34-0410-b5e6-
96231b3b80d8
if (Result->is(tok::eof))
--Arg;
}
+ assert(Result < Start+NumUnexpArgTokens && "Invalid arg #");
return Result;
}
Tok.setLocation(EndLoc);
Tok.setLength(0);
ArgTokens.push_back(Tok);
+
+ // If we expect two arguments, add both as empty.
+ if (NumActuals == 0 && MinArgsExpected == 2)
+ ArgTokens.push_back(Tok);
+
} else if (NumActuals > MinArgsExpected && !MI->isVariadic()) {
// Emit the diagnostic at the macro name in case there is a missing ).
// Emitting it at the , could be far away from the macro name.
B: f(f))
C: for(for))
+// rdar://6880648
+#define f(x,y...) y
+f()