[clang-tools-extra] [llvm] [llvm][ADT] Add wrapper to `std::search` and `std::adjacent_find` (PR #171666)

Baranov Victor via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 11 06:10:45 PST 2025


================
@@ -57,23 +57,24 @@ utils::UseRangesCheck::ReplacerMap UseRangesCheck::getReplacerMap() const {
 
   // Single range algorithms
   AddStdToLLVM(llvm::makeIntrusiveRefCnt<StdToLLVMReplacer>(SingleSig),
-               {"all_of",      "any_of",
-                "none_of",     "for_each",
-                "find",        "find_if",
-                "find_if_not", "fill",
-                "count",       "count_if",
-                "copy",        "copy_if",
-                "transform",   "replace",
-                "remove_if",   "stable_sort",
-                "partition",   "partition_point",
-                "is_sorted",   "min_element",
-                "max_element", "binary_search",
-                "lower_bound", "upper_bound",
-                "unique",      "uninitialized_copy"});
+               {"all_of",       "any_of",
+                "none_of",      "for_each",
+                "find",         "find_if",
+                "find_if_not",  "fill",
+                "count",        "count_if",
+                "copy",         "copy_if",
+                "transform",    "replace",
+                "remove_if",    "stable_sort",
+                "partition",    "partition_point",
+                "is_sorted",    "min_element",
+                "max_element",  "binary_search",
+                "lower_bound",  "upper_bound",
+                "unique",       "uninitialized_copy",
+                "adjacent_find"});
 
   // Two range algorithms
   AddStdToLLVM(llvm::makeIntrusiveRefCnt<StdToLLVMReplacer>(TwoSig),
-               {"equal", "mismatch", "includes"});
+               {"equal", "mismatch", "includes", "search"});
----------------
vbvictor wrote:

Yes, there aren't explicit tests for every function in the list because I think it essentially leads to copypaste in two places instead of one, which will still have potential "copypaste errors".

I'm fine landing as is as long as everyone happy merging ADT + clang-tidy changes.


https://github.com/llvm/llvm-project/pull/171666


More information about the llvm-commits mailing list