1// RUN: %check_clang_tidy -std=c++20-or-later %s readability-use-anyofallof %t
2
3bool good_any_of() {
4 int v[] = {1, 2, 3};
5 // CHECK-MESSAGES: :[[@LINE+1]]:3: warning: replace loop by 'std::ranges::any_of()'
6 for (int i : v)
7 if (i)
8 return true;
9 return false;
10}
11
12bool good_all_of() {
13 int v[] = {1, 2, 3};
14 // CHECK-MESSAGES: :[[@LINE+1]]:3: warning: replace loop by 'std::ranges::all_of()'
15 for (int i : v)
16 if (i)
17 return false;
18 return true;
19}
20

source code of clang-tools-extra/test/clang-tidy/checkers/readability/use-anyofallof-cpp20.cpp