[clang-tools-extra] [clang-tidy] Fix when std::ranges::fix is offered on a pointer type in `modernize-use-ranges` (PR #226739)
Umut Zengin via cfe-commits
cfe-commits at lists.llvm.org
Sun Sep 27 12:42:29 PDT 2026
================
@@ -27,6 +28,18 @@ void Positives() {
// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use a ranges version of this algorithm
// CHECK-FIXES: std::ranges::find(I, 1);
+ std::find(P->cbegin(), P->cend(), 2);
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use a ranges version of this algorithm
+ // CHECK-FIXES: std::ranges::find(*P, 2);
+
+ std::find(P->begin(), P->end(), 3);
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use a ranges version of this algorithm
+ // CHECK-FIXES: std::ranges::find(*P, 3);
+
+ std::find((P + 1)->begin(), (P + 1)->end(), 4);
----------------
ZenginU wrote:
I have added the case for "(P)->begin()". (P+1) already exists. Please let me know if thats what you meant.
https://github.com/llvm/llvm-project/pull/226739
More information about the cfe-commits
mailing list