================
@@ -164,28 +164,27 @@ static bool isLikelyTypo(const NamedDeclRange 
&Candidates, StringRef ArgName,
   if (ThisED >= UpperBound)
     return false;
 
-  for (const auto &Candidate : Candidates) {
-    const IdentifierInfo *II = Candidate->getIdentifier();
-    if (II->getName() == TargetName)
-      continue;
-
-    if (!II)
-      continue;
-
-    const unsigned Threshold = 2;
-    // Other candidates must be an edit distance at least Threshold more away
-    // from this candidate. This gives us greater confidence that this is a
-    // typo of this candidate and not one with a similar name.
-    const llvm::SmallString<64> CandidateLower =
-        getLowercasedString(II->getName());
-    const unsigned OtherED = ArgNameLowerRef.edit_distance(
-        StringRef(CandidateLower),
-        /*AllowReplacements=*/true, ThisED + Threshold);
-    if (OtherED < ThisED + Threshold)
-      return false;
-  }
-
-  return true;
+  return std::all_of(Candidates.begin(), Candidates.end(),
----------------
vbvictor wrote:

We should use `llvm::all_of(Candidates, [&]() {...})`.
We have check 
https://clang.llvm.org/extra/clang-tidy/checks/llvm/use-ranges.html for it, but 
it is only enabled in clang-tidy-22 (CI has 21)

https://github.com/llvm/llvm-project/pull/172521
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to