[clang-tools-extra] [clang-tidy] Fix false positive in readability-redundant-parentheses … (PR #192827)

via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 19 10:53:34 PDT 2026


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Windows-->
# :window: Windows x64 Test Results

* 3133 tests passed
* 30 tests skipped
* 2 tests failed

## Failed Tests
(click on a test name to see its output)

### Clang Tools
<details>
<summary>Clang Tools.clang-tidy/checkers/readability/redundant-parentheses.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\readability\redundant-parentheses.cpp readability-redundant-parentheses C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp
# 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\readability\redundant-parentheses.cpp' readability-redundant-parentheses 'C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp'
# .---command stdout------------
# | Running ['clang-tidy', '--experimental-custom-checks', 'C:\\_work\\llvm-project\\llvm-project\\build\\tools\\clang\\tools\\extra\\test\\clang-tidy\\checkers\\readability\\Output\\redundant-parentheses.cpp.tmp.cpp', '-fix', '--checks=-*,readability-redundant-parentheses', '--config={}', '--', '-std=c++11', '-nostdinc++', '-isystem', 'C:\\_work\\llvm-project\\llvm-project\\clang-tools-extra\\test\\clang-tidy\\checkers\\Inputs\\Headers\\std']...
# | ------------------------ clang-tidy output -----------------------
# | 48 warnings generated.
# | 
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:5:3: warning: redundant parentheses around expression [readability-redundant-parentheses]
# |     5 |   (1 + 1);
# |       |   ^     ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:5:3: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:5:9: note: FIX-IT applied suggested code changes
# |     5 |   (1 + 1);
# |       |         ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:6:3: warning: redundant parentheses around expression [readability-redundant-parentheses]
# |     6 |   ((1 + 1));
# |       |   ^       ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:6:3: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:6:11: note: FIX-IT applied suggested code changes
# |     6 |   ((1 + 1));
# |       |           ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:6:4: warning: redundant parentheses around expression [readability-redundant-parentheses]
# |     6 |   ((1 + 1));
# |       |    ^     ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:6:4: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:6:10: note: FIX-IT applied suggested code changes
# |     6 |   ((1 + 1));
# |       |          ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:9:3: warning: redundant parentheses around expression [readability-redundant-parentheses]
# |     9 |   (((1 + 1)));
# |       |   ^         ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:9:3: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:9:13: note: FIX-IT applied suggested code changes
# |     9 |   (((1 + 1)));
# |       |             ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:9:4: warning: redundant parentheses around expression [readability-redundant-parentheses]
# |     9 |   (((1 + 1)));
# |       |    ^       ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:9:4: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:9:12: note: FIX-IT applied suggested code changes
# |     9 |   (((1 + 1)));
# |       |            ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:9:5: warning: redundant parentheses around expression [readability-redundant-parentheses]
# |     9 |   (((1 + 1)));
# |       |     ^     ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:9:5: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:9:11: note: FIX-IT applied suggested code changes
# |     9 |   (((1 + 1)));
# |       |           ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:13:3: warning: redundant parentheses around expression [readability-redundant-parentheses]
# |    13 |   ((((1 + 1))));
# |       |   ^           ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:13:3: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:13:15: note: FIX-IT applied suggested code changes
# |    13 |   ((((1 + 1))));
# |       |               ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:13:4: warning: redundant parentheses around expression [readability-redundant-parentheses]
# |    13 |   ((((1 + 1))));
# |       |    ^         ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:13:4: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:13:14: note: FIX-IT applied suggested code changes
# |    13 |   ((((1 + 1))));
# |       |              ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:13:5: warning: redundant parentheses around expression [readability-redundant-parentheses]
# |    13 |   ((((1 + 1))));
# |       |     ^       ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:13:5: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:13:13: note: FIX-IT applied suggested code changes
# |    13 |   ((((1 + 1))));
# |       |             ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:13:6: warning: redundant parentheses around expression [readability-redundant-parentheses]
# |    13 |   ((((1 + 1))));
# |       |      ^     ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:13:6: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:13:12: note: FIX-IT applied suggested code changes
# |    13 |   ((((1 + 1))));
# |       |            ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:25:3: warning: redundant parentheses around expression [readability-redundant-parentheses]
# |    25 |   ((EXP)); // 3
# |       |   ^     ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:25:3: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:25:9: note: FIX-IT applied suggested code changes
# |    25 |   ((EXP)); // 3
# |       |         ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:32:3: warning: redundant parentheses around expression [readability-redundant-parentheses]
# |    32 |   (1);
# |       |   ^ ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:32:3: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:32:5: note: FIX-IT applied suggested code changes
# |    32 |   (1);
# |       |     ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:35:3: warning: redundant parentheses around expression [readability-redundant-parentheses]
# |    35 |   (1.0);
# |       |   ^   ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:35:3: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:35:7: note: FIX-IT applied suggested code changes
# |    35 |   (1.0);
# |       |       ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:38:3: warning: redundant parentheses around expression [readability-redundant-parentheses]
# |    38 |   (true);
# |       |   ^    ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:38:3: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:38:8: note: FIX-IT applied suggested code changes
# |    38 |   (true);
# |       |        ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:41:3: warning: redundant parentheses around expression [readability-redundant-parentheses]
# |    41 |   (',');
# |       |   ^   ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:41:3: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:41:7: note: FIX-IT applied suggested code changes
# |    41 |   (',');
# |       |       ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:44:3: warning: redundant parentheses around expression [readability-redundant-parentheses]
# |    44 |   ("v4");
# |       |   ^    ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:44:3: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:44:8: note: FIX-IT applied suggested code changes
# |    44 |   ("v4");
# |       |        ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:47:3: warning: redundant parentheses around expression [readability-redundant-parentheses]
# |    47 |   (nullptr);
# |       |   ^       ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:47:3: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:47:11: note: FIX-IT applied suggested code changes
# |    47 |   (nullptr);
# |       |           ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:53:3: warning: redundant parentheses around expression [readability-redundant-parentheses]
# |    53 |   (a);
# |       |   ^ ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:53:3: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:53:5: note: FIX-IT applied suggested code changes
# |    53 |   (a);
# |       |     ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:61:11: warning: redundant parentheses around expression [readability-redundant-parentheses]
# |    61 |   alignof((3));
# |       |           ^ ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:61:11: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:61:13: note: FIX-IT applied suggested code changes
# |    61 |   alignof((3));
# |       |             ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:83:8: warning: redundant parentheses around expression [readability-redundant-parentheses]
# |    83 |    if ((x)) {
# |       |        ^ ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:83:8: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:83:10: note: FIX-IT applied suggested code changes
# |    83 |    if ((x)) {
# |       |          ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:87:7: warning: redundant parentheses around expression [readability-redundant-parentheses]
# |    87 |    if((this->x)) {
# |       |       ^       ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:87:7: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:87:15: note: FIX-IT applied suggested code changes
# |    87 |    if((this->x)) {
# |       |               ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:104:7: warning: redundant parentheses around expression [readability-redundant-parentheses]
# |   104 |   if ((foo.x)) {
# |       |       ^     ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:104:7: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:104:13: note: FIX-IT applied suggested code changes
# |   104 |   if ((foo.x)) {
# |       |             ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:109:7: warning: redundant parentheses around expression [readability-redundant-parentheses]
# |   109 |   if ((foo.y.z)) {
# |       |       ^       ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:109:7: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:109:15: note: FIX-IT applied suggested code changes
# |   109 |   if ((foo.y.z)) {
# |       |               ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:114:7: warning: redundant parentheses around expression [readability-redundant-parentheses]
# |   114 |   if ((foo.bar())) {
# |       |       ^         ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:114:7: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:114:17: note: FIX-IT applied suggested code changes
# |   114 |   if ((foo.bar())) {
# |       |                 ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:119:7: warning: redundant parentheses around expression [readability-redundant-parentheses]
# |   119 |   if ((foo.fooBar().z)) {
# |       |       ^              ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:119:7: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:119:22: note: FIX-IT applied suggested code changes
# |   119 |   if ((foo.fooBar().z)) {
# |       |                      ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:133:7: warning: redundant parentheses around expression [readability-redundant-parentheses]
# |   133 |   if ((it != end))
# |       |       ^         ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:133:7: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:133:17: note: FIX-IT applied suggested code changes
# |   133 |   if ((it != end))
# |       |                 ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:137:7: warning: redundant parentheses around expression [readability-redundant-parentheses]
# |   137 |   if ((it == end))
# |       |       ^         ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:137:7: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:137:17: note: FIX-IT applied suggested code changes
# |   137 |   if ((it == end))
# |       |                 ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:141:7: warning: redundant parentheses around expression [readability-redundant-parentheses]
# |   141 |   if ((i == 0))
# |       |       ^      ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:141:7: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:141:14: note: FIX-IT applied suggested code changes
# |   141 |   if ((i == 0))
# |       |              ^
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:145:10: warning: redundant parentheses around expression [readability-redundant-parentheses]
# |   145 |   return (it >= end);
# |       |          ^         ~
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:145:10: note: FIX-IT applied suggested code changes
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:145:20: note: FIX-IT applied suggested code changes
# | clang-tidy applied 58 of 58 suggested fixes.
# | 
# |   145 |   return (it >= end);
# |       |                    ^
# | Suppressed 19 warnings (19 with check filters).
# | 
# | 
# | ------------------------------------------------------------------
# | diff -u C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.orig C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp failed:
# | --- C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.orig	2026-04-19 17:52:07.021594000 +0000
# | +++ C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp	2026-04-19 17:52:07.080031900 +0000
# | @@ -2,15 +2,15 @@
# |  
# | 
# |  void parenExpr() {
# | 
# |    1 + 1;
# | 
# | -  (1 + 1);
# | 
# | -  ((1 + 1));
# | 
# | +  1 + 1;
# | 
# | +  1 + 1;
# | 
# |    //
# | 
# |    //
# | 
# | -  (((1 + 1)));
# | 
# | +  1 + 1;
# | 
# |    //
# | 
# |    //
# | 
# |    //
# | 
# | -  ((((1 + 1))));
# | 
# | +  1 + 1;
# | 
# |    //
# | 
# |    //
# | 
# |    //
# | 
# | @@ -22,35 +22,35 @@
# |  void parenExprWithMacro() {
# | 
# |    EXP; // 1
# | 
# |    (EXP); // 2
# | 
# | -  ((EXP)); // 3
# | 
# | +  (EXP); // 3
# | 
# |    //
# | 
# |    //
# | 
# |    PAREN((1));
# | 
# |  }
# | 
# |  
# | 
# |  void constant() {
# | 
# | -  (1);
# | 
# | +  1;
# | 
# |    //
# | 
# |    //
# | 
# | -  (1.0);
# | 
# | +  1.0;
# | 
# |    //
# | 
# |    //
# | 
# | -  (true);
# | 
# | +  true;
# | 
# |    //
# | 
# |    //
# | 
# | -  (',');
# | 
# | +  ',';
# | 
# |    //
# | 
# |    //
# | 
# | -  ("v4");
# | 
# | +  "v4";
# | 
# |    //
# | 
# |    //
# | 
# | -  (nullptr);
# | 
# | +  nullptr;
# | 
# |    //
# | 
# |    //
# | 
# |  }
# | 
# |  
# | 
# |  void declRefExpr(int a) {
# | 
# | -  (a);
# | 
# | +  a;
# | 
# |    //
# | 
# |    //
# | 
# |  }
# | 
# | @@ -58,7 +58,7 @@
# |  void exceptions() {
# | 
# |    sizeof(1);
# | 
# |    alignof(2);
# | 
# | -  alignof((3));
# | 
# | +  alignof(3);
# | 
# |    //
# | 
# |    //
# | 
# |  }
# | 
# | @@ -80,11 +80,11 @@
# |    } y;
# | 
# |    void foo()
# | 
# |    {
# | 
# | -   if ((x)) {
# | 
# | +   if (x) {
# | 
# |       //
# | 
# |       //
# | 
# |     }
# | 
# | -   if((this->x)) {
# | 
# | +   if(this->x) {
# | 
# |       //
# | 
# |       //
# | 
# |     }
# | 
# | @@ -101,22 +101,22 @@
# |  
# | 
# |  void memberExpr() {
# | 
# |    Foo foo{};
# | 
# | -  if ((foo.x)) {
# | 
# | +  if (foo.x) {
# | 
# |     //
# | 
# |     //
# | 
# |    }
# | 
# |  
# | 
# | -  if ((foo.y.z)) {
# | 
# | +  if (foo.y.z) {
# | 
# |     //
# | 
# |     //
# | 
# |    }
# | 
# |  
# | 
# | -  if ((foo.bar())) {
# | 
# | +  if (foo.bar()) {
# | 
# |     //
# | 
# |     //
# | 
# |    }
# | 
# |  
# | 
# | -  if ((foo.fooBar().z)) {
# | 
# | +  if (foo.fooBar().z) {
# | 
# |     //
# | 
# |     //
# | 
# |    }
# | 
# | @@ -130,19 +130,19 @@
# |  
# | 
# |  // Both overloaded and built-in operators warn: parens are redundant.
# | 
# |  bool operatorWarn(Iterator it, Iterator end, int i) {
# | 
# | -  if ((it != end))
# | 
# | +  if (it != end)
# | 
# |      //
# | 
# |      //
# | 
# |      return true;
# | 
# | -  if ((it == end))
# | 
# | +  if (it == end)
# | 
# |      //
# | 
# |      //
# | 
# |      return false;
# | 
# | -  if ((i == 0))
# | 
# | +  if (i == 0)
# | 
# |      //
# | 
# |      //
# | 
# |      return true;
# | 
# | -  return (it >= end);
# | 
# | +  return it >= end;
# | 
# |    //
# | 
# |    //
# | 
# |  }
# | 
# | 
# | ------------------------------ Fixes -----------------------------
# | --- C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.orig	2026-04-19 17:52:07.021594000 +0000
# | +++ C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp	2026-04-19 17:52:07.080031900 +0000
# | @@ -2,15 +2,15 @@
# |  
# | 
# |  void parenExpr() {
# | 
# |    1 + 1;
# | 
# | -  (1 + 1);
# | 
# | -  ((1 + 1));
# | 
# | +  1 + 1;
# | 
# | +  1 + 1;
# | 
# |    //
# | 
# |    //
# | 
# | -  (((1 + 1)));
# | 
# | +  1 + 1;
# | 
# |    //
# | 
# |    //
# | 
# |    //
# | 
# | -  ((((1 + 1))));
# | 
# | +  1 + 1;
# | 
# |    //
# | 
# |    //
# | 
# |    //
# | 
# | @@ -22,35 +22,35 @@
# |  void parenExprWithMacro() {
# | 
# |    EXP; // 1
# | 
# |    (EXP); // 2
# | 
# | -  ((EXP)); // 3
# | 
# | +  (EXP); // 3
# | 
# |    //
# | 
# |    //
# | 
# |    PAREN((1));
# | 
# |  }
# | 
# |  
# | 
# |  void constant() {
# | 
# | -  (1);
# | 
# | +  1;
# | 
# |    //
# | 
# |    //
# | 
# | -  (1.0);
# | 
# | +  1.0;
# | 
# |    //
# | 
# |    //
# | 
# | -  (true);
# | 
# | +  true;
# | 
# |    //
# | 
# |    //
# | 
# | -  (',');
# | 
# | +  ',';
# | 
# |    //
# | 
# |    //
# | 
# | -  ("v4");
# | 
# | +  "v4";
# | 
# |    //
# | 
# |    //
# | 
# | -  (nullptr);
# | 
# | +  nullptr;
# | 
# |    //
# | 
# |    //
# | 
# |  }
# | 
# |  
# | 
# |  void declRefExpr(int a) {
# | 
# | -  (a);
# | 
# | +  a;
# | 
# |    //
# | 
# |    //
# | 
# |  }
# | 
# | @@ -58,7 +58,7 @@
# |  void exceptions() {
# | 
# |    sizeof(1);
# | 
# |    alignof(2);
# | 
# | -  alignof((3));
# | 
# | +  alignof(3);
# | 
# |    //
# | 
# |    //
# | 
# |  }
# | 
# | @@ -80,11 +80,11 @@
# |    } y;
# | 
# |    void foo()
# | 
# |    {
# | 
# | -   if ((x)) {
# | 
# | +   if (x) {
# | 
# |       //
# | 
# |       //
# | 
# |     }
# | 
# | -   if((this->x)) {
# | 
# | +   if(this->x) {
# | 
# |       //
# | 
# |       //
# | 
# |     }
# | 
# | @@ -101,22 +101,22 @@
# |  
# | 
# |  void memberExpr() {
# | 
# |    Foo foo{};
# | 
# | -  if ((foo.x)) {
# | 
# | +  if (foo.x) {
# | 
# |     //
# | 
# |     //
# | 
# |    }
# | 
# |  
# | 
# | -  if ((foo.y.z)) {
# | 
# | +  if (foo.y.z) {
# | 
# |     //
# | 
# |     //
# | 
# |    }
# | 
# |  
# | 
# | -  if ((foo.bar())) {
# | 
# | +  if (foo.bar()) {
# | 
# |     //
# | 
# |     //
# | 
# |    }
# | 
# |  
# | 
# | -  if ((foo.fooBar().z)) {
# | 
# | +  if (foo.fooBar().z) {
# | 
# |     //
# | 
# |     //
# | 
# |    }
# | 
# | @@ -130,19 +130,19 @@
# |  
# | 
# |  // Both overloaded and built-in operators warn: parens are redundant.
# | 
# |  bool operatorWarn(Iterator it, Iterator end, int i) {
# | 
# | -  if ((it != end))
# | 
# | +  if (it != end)
# | 
# |      //
# | 
# |      //
# | 
# |      return true;
# | 
# | -  if ((it == end))
# | 
# | +  if (it == end)
# | 
# |      //
# | 
# |      //
# | 
# |      return false;
# | 
# | -  if ((i == 0))
# | 
# | +  if (i == 0)
# | 
# |      //
# | 
# |      //
# | 
# |      return true;
# | 
# | -  return (it >= end);
# | 
# | +  return it >= end;
# | 
# |    //
# | 
# |    //
# | 
# |  }
# | 
# | 
# | ------------------------------------------------------------------
# | FileCheck --input-file=C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\readability\redundant-parentheses.cpp --check-prefixes=CHECK-FIXES --match-full-lines failed:
# | C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\readability\redundant-parentheses.cpp:8:18: error: CHECK-FIXES: expected string not found in input
# | 
# |  // CHECK-FIXES: (1 + 1);
# | 
# |                  ^
# | 
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:1:1: note: scanning from here
# | 
# | // RUN: %check_clang_tidy %s readability-redundant-parentheses %t
# | 
# | ^
# | 
# | C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp:20:11: note: possible intended match here
# | 
# | #define EXP (1 + 1)
# | 
# |           ^
# | 
# | 
# | 
# | Input file: C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\readability\Output\redundant-parentheses.cpp.tmp.cpp
# | 
# | Check file: C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\readability\redundant-parentheses.cpp
# | 
# | 
# | 
# | -dump-input=help explains the following input dump.
# | 
# | 
# | 
# | Input was:
# | 
# | <<<<<<
# | 
# |            1: // RUN: %check_clang_tidy %s readability-redundant-parentheses %t 
# | 
# | check:8'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
# | 
# |            2:  
# | 
# | check:8'0     ~
# | 
# |            3: void parenExpr() { 
# | 
# | check:8'0     ~~~~~~~~~~~~~~~~~~~
# | 
# |            4:  1 + 1; 
# | 
# | check:8'0     ~~~~~~~~
# | 
# |            5:  1 + 1; 
# | 
# | check:8'0     ~~~~~~~~
# | 
# |            6:  1 + 1; 
# | 
# | check:8'0     ~~~~~~~~
# | 
# |            .
# | 
# |            .
# | 
# |            .
# | 
# |           15:  // 
# | 
# | check:8'0     ~~~~
# | 
# |           16:  // 
# | 
# | check:8'0     ~~~~
# | 
# |           17:  // 
# | 
# | check:8'0     ~~~~
# | 
# |           18: } 
# | 
# | check:8'0     ~~
# | 
# |           19:  
# | 
# | check:8'0     ~
# | 
# |           20: #define EXP (1 + 1) 
# | 
# | check:8'0     ~~~~~~~~~~~~~~~~~~~~
# | 
# | check:8'1               ?          possible intended match
# | 
# |           21: #define PAREN(e) (e) 
# | 
# | check:8'0     ~~~~~~~~~~~~~~~~~~~~~
# | 
# |           22: void parenExprWithMacro() { 
# | 
# | check:8'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 
# |           23:  EXP; // 1 
# | 
# | check:8'0     ~~~~~~~~~~~
# | 
# |           24:  (EXP); // 2 
# | 
# | check:8'0     ~~~~~~~~~~~~~
# | 
# |           25:  (EXP); // 3 
# | 
# | check:8'0     ~~~~~~~~~~~~~
# | 
# |            .
# | 
# |            .
# | 
# |            .
# | 
# | >>>>>>
# | 
# | 
# `-----------------------------
# .---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 554, in <module>
# |     main()
# |   File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 550, 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 432, in run
# |     self.check_fixes()
# |   File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 327, in check_fixes
# |     try_run(
# |   File "C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py", line 64, 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\\readability\\Output\\redundant-parentheses.cpp.tmp.cpp', 'C:\\_work\\llvm-project\\llvm-project\\clang-tools-extra\\test\\clang-tidy\\checkers\\readability\\redundant-parentheses.cpp', '--check-prefixes=CHECK-FIXES', '--match-full-lines']' returned non-zero exit status 1.
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>
<details>
<summary>Clang Tools.clang-tidy/infrastructure/alphabetical-order.test</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\clang-tidy\infrastructure/../../../clang-tidy/tool/check_alphabetical_order.py -o C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\alphabetical-order.test.tmp.clang-tidy-checks-list.rst
# executed command: C:/Python312/python.exe 'C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\infrastructure/../../../clang-tidy/tool/check_alphabetical_order.py' -o 'C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\alphabetical-order.test.tmp.clang-tidy-checks-list.rst'
# note: command had no output on stdout or stderr
# RUN: at line 2
diff --strip-trailing-cr C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\infrastructure/../../../docs/clang-tidy/checks/list.rst C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\alphabetical-order.test.tmp.clang-tidy-checks-list.rst
# executed command: diff --strip-trailing-cr 'C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\infrastructure/../../../docs/clang-tidy/checks/list.rst' 'C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\alphabetical-order.test.tmp.clang-tidy-checks-list.rst'
# note: command had no output on stdout or stderr
# RUN: at line 4
C:/Python312/python.exe C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\infrastructure/../../../clang-tidy/tool/check_alphabetical_order.py -o C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\alphabetical-order.test.tmp.ReleaseNotes.rst
# executed command: C:/Python312/python.exe 'C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\infrastructure/../../../clang-tidy/tool/check_alphabetical_order.py' -o 'C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\alphabetical-order.test.tmp.ReleaseNotes.rst'
# .---command stderr------------
# | 
# | Entries in 'clang-tools-extra/docs/ReleaseNotes.rst' are not alphabetically sorted.
# | Fix the ordering by applying diff printed below.
# | 
# `-----------------------------
# RUN: at line 5
diff --strip-trailing-cr C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\infrastructure/../../../docs/ReleaseNotes.rst C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\alphabetical-order.test.tmp.ReleaseNotes.rst
# executed command: diff --strip-trailing-cr 'C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\infrastructure/../../../docs/ReleaseNotes.rst' 'C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\alphabetical-order.test.tmp.ReleaseNotes.rst'
# .---command stdout------------
# | *** C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\infrastructure/../../../docs/ReleaseNotes.rst
# | --- C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\infrastructure\Output\alphabetical-order.test.tmp.ReleaseNotes.rst
# | ***************
# | *** 530,546 ****
# |     - Fixed a false positive in array subscript expressions where the types are
# |       not yet resolved.
# |   
# |   - Improved :doc:`readability-redundant-parentheses
# |     <clang-tidy/checks/readability/redundant-parentheses>` check to consistently
# |     warn for parenthesized built-in binary operator expressions (e.g.
# |     ``(i == 0)``), matching the existing behavior for overloaded operator
# |     expressions.
# |   
# | - - Improved :doc:`readability-redundant-member-init
# | -   <clang-tidy/checks/readability/redundant-member-init>` check by adding an
# | -   `IgnoreMacros` option to suppress warnings when the initializer involves
# | -   macros that may expand differently in other configurations.
# | - 
# |   - Improved :doc:`readability-redundant-preprocessor
# |     <clang-tidy/checks/readability/redundant-preprocessor>` check by fixing a
# |     false positive for nested ``#if`` directives using different builtin
# | --- 530,546 ----
# |     - Fixed a false positive in array subscript expressions where the types are
# |       not yet resolved.
# |   
# | + - Improved :doc:`readability-redundant-member-init
# | +   <clang-tidy/checks/readability/redundant-member-init>` check by adding an
# | +   `IgnoreMacros` option to suppress warnings when the initializer involves
# | +   macros that may expand differently in other configurations.
# | + 
# |   - Improved :doc:`readability-redundant-parentheses
# |     <clang-tidy/checks/readability/redundant-parentheses>` check to consistently
# |     warn for parenthesized built-in binary operator expressions (e.g.
# |     ``(i == 0)``), matching the existing behavior for overloaded operator
# |     expressions.
# |   
# |   - Improved :doc:`readability-redundant-preprocessor
# |     <clang-tidy/checks/readability/redundant-preprocessor>` check by fixing a
# |     false positive for nested ``#if`` directives using different builtin
# `-----------------------------
# 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/192827


More information about the cfe-commits mailing list