[Refactoring] Handle default arguments when converting call to async

Default arguments were still being visited when converting the call,
adding extra commas to the converted call. Skip over them.

Resolves rdar://74248990
This commit is contained in:
Ben Barham
2021-02-12 07:28:34 +10:00
parent 384b309f89
commit 0717448611
2 changed files with 25 additions and 2 deletions

View File

@@ -5155,12 +5155,17 @@ private:
/*ToEndOfToken=*/true);
OS << tok::l_paren;
size_t realArgCount = 0;
for (size_t I = 0, E = Args.size() - 1; I < E; ++I) {
if (I > 0)
if (isa<DefaultArgumentExpr>(Args[I]))
continue;
if (realArgCount > 0)
OS << tok::comma << " ";
// Can't just add the range as we need to perform replacements
convertNode(Args[I], /*StartOverride=*/CE->getArgumentLabelLoc(I),
/*ConvertCalls=*/false);
realArgCount++;
}
OS << tok::r_paren;
}