[clang-tools-extra] [clang-tidy] Add none_of suggestion to readability-use-anyofallof (PR #182065)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 6 12:13:17 PST 2026


================
@@ -84,6 +84,26 @@ static bool isViableLoop(const CXXForRangeStmt &S, ASTContext &Context) {
   });
 }
 
+/// For the all_of_loop pattern (returns false inside, true after), check
+/// whether the if-condition is negated. If it is, the loop is an all_of;
+/// otherwise it is a none_of.
+static bool isNoneOfPattern(const CXXForRangeStmt &Loop) {
----------------
vbvictor wrote:

Can we check this in matchers? We could optionally match the condition that is parent of return-stmt, something like: `optionally(hasParent(ifStmt(hasCondition(notNegated())).bind("none_of")))`.
Not sure about exact matchers, I think you will need to make `notNegated()`

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


More information about the cfe-commits mailing list