================ @@ -173,21 +174,21 @@ static void removeFunctionArgs(DiagnosticBuilder &Diag, const CallExpr &Call, for (unsigned Index : Sorted) { const Expr *Arg = Call.getArg(Index); if (Commas[Index]) { - if (Index >= Commas.size()) { - Diag << FixItHint::CreateRemoval(Arg->getSourceRange()); - } else { + if (Index + 1 < Call.getNumArgs()) { // Remove the next comma Commas[Index + 1] = true; + const Expr *NextArg = Call.getArg(Index + 1); Diag << FixItHint::CreateRemoval(CharSourceRange::getTokenRange( - {Arg->getBeginLoc(), - Lexer::getLocForEndOfToken( - Arg->getEndLoc(), 0, Ctx.getSourceManager(), Ctx.getLangOpts()) - .getLocWithOffset(1)})); + {Arg->getBeginLoc(), NextArg->getBeginLoc().getLocWithOffset(-1)})); ---------------- 5chmidti wrote:
This would remove parameter documentation (e.g., naming the argument), and result in the documentation of the removed argument to be associated with the next: E.g., removing argument 1 (`b`) ```diff void f(int a, int b); void g() { - f(/*a*/0,/*b*/1); + f(/*a*/1); } ``` I don't really see people doing this kind of documentation for calls to the STL, so I'm not sure that this needs to be blocked on this. The solution would be more checks: check if there is a previous argument, if so, then delete starting from its end+1, otherwise delete from the lparen+1 loc (which would need to be found first) https://github.com/llvm/llvm-project/pull/118568 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits