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

via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 17 07:52:01 PDT 2026


================
@@ -203,9 +203,17 @@ infrastructure are described first, followed by tool-specific sections.
   the pointer points to an incomplete (forward-declared) type.
 
 - Improved {doc}`bugprone-redundant-branch-condition
-  <clang-tidy/checks/bugprone/redundant-branch-condition>` check by fixing
-  false positives when the condition variable is changed later in a loop that
-  encloses the inner `if`.
+  <clang-tidy/checks/bugprone/redundant-branch-condition>` check:
+  
+    - Fixed false positives when the condition variable is changed later in a loop that
+      encloses the inner `if`.
+
+    - Fixed false negatives when two variables are present on both sides
+      of logical AND(`&&`) in `if` like `a && b`. Previously, it was only evaluated for 
+      first variable `a` and completely ignored the second variable `b` for redundant
+      branch condition.For example, In `(x && y) { if (y){} if(x){} }` a warning was
+      only generated for nested `if` with x(`if(x){}`) and never generated for nested `if`
+      with y(`if (y){}`).
----------------
EugeneZelenko wrote:

```suggestion
      of logical AND (`&&`) in `if` like `a && b`.
```

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


More information about the cfe-commits mailing list