[clang-tools-extra] [clang-tidy] Fix false negative for binary logical expressions for tw… (PR #230846)

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 12 04:22:52 PDT 2026


================
@@ -76,10 +76,9 @@ void RedundantBranchConditionCheck::registerMatchers(MatchFinder *Finder) {
       ifStmt(
           hasCondition(anyOf(
               declRefExpr(hasDeclaration(ImmutableVar)).bind(OuterIfVar1Str),
-              binaryOperator(
-                  hasOperatorName("&&"),
-                  hasEitherOperand(declRefExpr(hasDeclaration(ImmutableVar))
-                                       .bind(OuterIfVar2Str))))),
+              binaryOperator(hasOperatorName("&&"),
+                             forEach((declRefExpr(hasDeclaration(ImmutableVar))
----------------
zwuis wrote:

nit: redundant parentheses `forEach((`?

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


More information about the cfe-commits mailing list