[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 10 18:10:10 PDT 2026
github-actions[bot] wrote:
<!--PREMERGE ADVISOR COMMENT: Windows-->
# :window: Windows x64 Test Results
* 3399 tests passed
* 38 tests skipped
* 1 test failed
## Failed Tests
(click on a test name to see its output)
### Clang Tools
<details>
<summary>Clang Tools.clang-tidy/checkers/bugprone/redundant-branch-condition.cpp</summary>
```
Exit Code: 1
Command Output (stdout):
--
# RUN: at line 1
C:/Python312/python.exe C:/_work/llvm-project/llvm-project/clang-tools-extra/test/../test\clang-tidy\check_clang_tidy.py C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\bugprone\redundant-branch-condition.cpp bugprone-redundant-branch-condition C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp -- -- -fblocks
# executed command: C:/Python312/python.exe 'C:/_work/llvm-project/llvm-project/clang-tools-extra/test/../test\clang-tidy\check_clang_tidy.py' 'C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\bugprone\redundant-branch-condition.cpp' bugprone-redundant-branch-condition 'C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp' -- -- -fblocks
# .---command stdout------------
# | Running ['clang-tidy', '--experimental-custom-checks', 'C:\\_work\\llvm-project\\llvm-project\\build\\tools\\clang\\tools\\extra\\test\\clang-tidy\\checkers\\bugprone\\Output\\redundant-branch-condition.cpp.tmp.cpp', '-fix', '--checks=-*,bugprone-redundant-branch-condition', '--config={}', '--', '-fblocks', '-std=c++11', '-nostdinc++', '-isystem', 'C:\\_work\\llvm-project\\llvm-project\\clang-tools-extra\\test\\clang-tidy\\checkers\\Inputs\\Headers\\std']...
# | ------------------------ clang-tidy output -----------------------
# | 49 warnings generated.
# |
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:23:5: warning: redundant condition 'onFire' [bugprone-redundant-branch-condition]
# | 23 | if (onFire) {
# | | ^~~~~~~~~~~~~
# | 24 | //
# | 25 | //
# | 26 | scream();
# | 27 | }
# | | ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:23:5: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:27:5: note: FIX-IT applied suggested code changes
# | 27 | }
# | | ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:36:7: warning: redundant condition 'onFire' [bugprone-redundant-branch-condition]
# | 36 | if (onFire)
# | | ^~~~~~~~~~~
# | 37 | //
# | | ~~
# | 38 | //
# | | ~~
# | 39 | scream();
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:36:7: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:47:5: warning: redundant condition 'onFire' [bugprone-redundant-branch-condition]
# | 47 | if (onFire && peopleInTheBuilding > 0) {
# | | ^ ~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:47:9: note: FIX-IT applied suggested code changes
# | 47 | if (onFire && peopleInTheBuilding > 0) {
# | | ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:59:7: warning: redundant condition 'onFire' [bugprone-redundant-branch-condition]
# | 59 | if (onFire && peopleInTheBuilding > 0) {
# | | ^ ~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:59:11: note: FIX-IT applied suggested code changes
# | 59 | if (onFire && peopleInTheBuilding > 0) {
# | | ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:71:5: warning: redundant condition 'onFire' [bugprone-redundant-branch-condition]
# | 71 | if (peopleInTheBuilding > 0 && onFire) {
# | | ^ ~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:71:33: note: FIX-IT applied suggested code changes
# | 71 | if (peopleInTheBuilding > 0 && onFire) {
# | | ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:83:7: warning: redundant condition 'onFire' [bugprone-redundant-branch-condition]
# | 83 | if (peopleInTheBuilding > 0 && onFire) {
# | | ^ ~~~~~~~~~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:83:35: note: FIX-IT applied suggested code changes
# | 83 | if (peopleInTheBuilding > 0 && onFire) {
# | | ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:95:5: warning: redundant condition 'onFire' [bugprone-redundant-branch-condition]
# | 95 | if (onFire || isCollapsing()) {
# | | ^~~~~~~~~~~~~ ~~~
# | | ;
# | 96 | //
# | 97 | //
# | 98 | scream();
# | 99 | }
# | | ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:95:5: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:95:33: note: FIX-IT applied suggested code changes
# | 95 | if (onFire || isCollapsing()) {
# | | ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:99:5: note: FIX-IT applied suggested code changes
# | 99 | }
# | | ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:108:7: warning: redundant condition 'onFire' [bugprone-redundant-branch-condition]
# | 108 | if (onFire || isCollapsing()) {
# | | ^~~~~~~~~~~~~ ~~~
# | | ;
# | 109 | //
# | 110 | //
# | 111 | scream();
# | 112 | }
# | | ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:108:7: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:108:35: note: FIX-IT applied suggested code changes
# | 108 | if (onFire || isCollapsing()) {
# | | ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:112:7: note: FIX-IT applied suggested code changes
# | 112 | }
# | | ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:121:5: warning: redundant condition 'onFire' [bugprone-redundant-branch-condition]
# | 121 | if (isCollapsing() || onFire) {
# | | ^~~~ ~~~~~~~~~~~~
# | | ;
# | 122 | //
# | 123 | //
# | 124 | scream();
# | 125 | }
# | | ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:121:5: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:121:24: note: FIX-IT applied suggested code changes
# | 121 | if (isCollapsing() || onFire) {
# | | ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:125:5: note: FIX-IT applied suggested code changes
# | 125 | }
# | | ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:134:7: warning: redundant condition 'onFire' [bugprone-redundant-branch-condition]
# | 134 | if (isCollapsing() || onFire) {
# | | ^~~~ ~~~~~~~~~~~~
# | | ;
# | 135 | //
# | 136 | //
# | 137 | scream();
# | 138 | }
# | | ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:134:7: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:134:26: note: FIX-IT applied suggested code changes
# | 134 | if (isCollapsing() || onFire) {
# | | ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:138:7: note: FIX-IT applied suggested code changes
# | 138 | }
# | | ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:147:5: warning: redundant condition 'onFire' [bugprone-redundant-branch-condition]
# | 147 | if (onFire) {
# | | ^~~~~~~~~~~~~
# | 148 | //
# | 149 | //
# | 150 | scream();
# | 151 | }
# | | ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:147:5: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:151:5: note: FIX-IT applied suggested code changes
# | 151 | }
# | | ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:160:7: warning: redundant condition 'onFire' [bugprone-redundant-branch-condition]
# | 160 | if (onFire) {
# | | ^~~~~~~~~~~~~
# | 161 | //
# | 162 | //
# | 163 | scream();
# | 164 | }
# | | ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\bugprone\Output\redundant-branch-condition.cpp.tmp.cpp:160:7: note: FIX-IT
# | ...
# `---data was truncated (10240/70329) (change limit with -D output_limit=N)
# .---command stderr------------
# | Traceback (most recent call last):
# | File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 576, in <module>
# | main()
# | File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 572, in main
# | CheckRunner(args, extra_args).run()
# | File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 437, in run
# | self.check_messages(main_output)
# | File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 362, in check_messages
# | try_run(
# | File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 68, in try_run
# | process_output = subprocess.check_output(args, stderr=subprocess.STDOUT).decode(
# | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# | File "c:\python312\Lib\subprocess.py", line 466, in check_output
# | return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
# | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# | File "c:\python312\Lib\subprocess.py", line 571, in run
# | raise CalledProcessError(retcode, process.args,
# | subprocess.CalledProcessError: Command '['FileCheck', '-input-file=C:\\_work\\llvm-project\\llvm-project\\build\\tools\\clang\\tools\\extra\\test\\clang-tidy\\checkers\\bugprone\\Output\\redundant-branch-condition.cpp.tmp.cpp.msg', 'C:\\_work\\llvm-project\\llvm-project\\clang-tools-extra\\test\\clang-tidy\\checkers\\bugprone\\redundant-branch-condition.cpp', '-check-prefixes=CHECK-MESSAGES', '-implicit-check-not={{warning|error}}:']' returned non-zero exit status 1.
# `-----------------------------
# error: command failed with exit status: 1
--
```
</details>
If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.
https://github.com/llvm/llvm-project/pull/230846
More information about the cfe-commits
mailing list