================
@@ -164,6 +164,33 @@ void UseRangesCheck::registerMatchers(MatchFinder *Finder) 
{
 static void removeFunctionArgs(DiagnosticBuilder &Diag, const CallExpr &Call,
                                ArrayRef<unsigned> Indexes,
                                const ASTContext &Ctx) {
+  auto GetCommaLoc =
+      [&](SourceLocation BeginLoc,
+          SourceLocation EndLoc) -> std::optional<CharSourceRange> {
+    auto Invalid = false;
+    auto SourceText = Lexer::getSourceText(
+        CharSourceRange::getCharRange({BeginLoc, EndLoc}),
+        Ctx.getSourceManager(), Ctx.getLangOpts(), &Invalid);
+    assert(!Invalid);
+
+    size_t I = 0;
+    while (I < SourceText.size() && SourceText[I] != ',') {
+      I++;
+    }
+
+    if (I < SourceText.size()) {
+      // also remove space after ,
+      size_t J = I + 1;
+      while (J < SourceText.size() && SourceText[J] == ' ') {
+        J++;
+      }
----------------
HerrCai0907 wrote:

replace with `find_first_of`

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

Reply via email to