[clang-tools-extra] [clang-tidy] Add new check 'readability-inconsistent-ifelse-braces' (PR #162361)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 30 08:07:44 PST 2025
github-actions[bot] wrote:
<!--PREMERGE ADVISOR COMMENT: Linux-->
# :penguin: Linux x64 Test Results
* 3056 tests passed
* 7 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/readability/inconsistent-ifelse-braces.cpp</summary>
```
Exit Code: 1
Command Output (stdout):
--
# RUN: at line 1
/usr/bin/python3 /home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/../test/clang-tidy/check_clang_tidy.py -std=c++98-or-later /home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/clang-tidy/checkers/readability/inconsistent-ifelse-braces.cpp readability-inconsistent-ifelse-braces /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp
# executed command: /usr/bin/python3 /home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/../test/clang-tidy/check_clang_tidy.py -std=c++98-or-later /home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/clang-tidy/checkers/readability/inconsistent-ifelse-braces.cpp readability-inconsistent-ifelse-braces /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp
# .---command stdout------------
# | Running ['clang-tidy', '--experimental-custom-checks', '/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp', '-fix', '--checks=-*,readability-inconsistent-ifelse-braces', '--config={}', '--', '-std=c++98', '-nostdinc++']...
# | ------------------------ clang-tidy output -----------------------
# | 15 warnings generated.
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:11:31: warning: statement should have braces [readability-inconsistent-ifelse-braces]
# | 11 | if (cond("if0") /*comment*/) do_something("if-same-line");
# | | ^
# | | {
# | 12 | else {
# | | }
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:11:31: note: FIX-IT applied suggested code changes
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:12:3: note: FIX-IT applied suggested code changes
# | 12 | else {
# | | ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:19:9: warning: statement should have braces [readability-inconsistent-ifelse-braces]
# | 19 | } else do_something("else-same-line");
# | | ^
# | | {
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:19:9: note: FIX-IT applied suggested code changes
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:19:41: note: FIX-IT applied suggested code changes
# | 19 | } else do_something("else-same-line");
# | | ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:24:19: warning: statement should have braces [readability-inconsistent-ifelse-braces]
# | 24 | if (cond("if1"))
# | | ^
# | | {
# | 25 | do_something("if-single-line");
# | 26 | else {
# | | }
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:24:19: note: FIX-IT applied suggested code changes
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:26:3: note: FIX-IT applied suggested code changes
# | 26 | else {
# | | ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:33:9: warning: statement should have braces [readability-inconsistent-ifelse-braces]
# | 33 | } else
# | | ^
# | | {
# | 34 | do_something("else-single-line");
# | |
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:33:9: note: FIX-IT applied suggested code changes
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:34:38: note: FIX-IT applied suggested code changes
# | 34 | do_something("else-single-line");
# | | ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:39:31: warning: statement should have braces [readability-inconsistent-ifelse-braces]
# | 39 | if (cond("if2") /*comment*/)
# | | ^
# | | {
# | 40 | // some comment
# | 41 | do_something("if-multi-line");
# | 42 | else {
# | | }
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:39:31: note: FIX-IT applied suggested code changes
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:42:3: note: FIX-IT applied suggested code changes
# | 42 | else {
# | | ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:49:9: warning: statement should have braces [readability-inconsistent-ifelse-braces]
# | 49 | } else
# | | ^
# | | {
# | 50 | // some comment
# | 51 | do_something("else-multi-line");
# | |
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:49:9: note: FIX-IT applied suggested code changes
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:51:37: note: FIX-IT applied suggested code changes
# | 51 | do_something("else-multi-line");
# | | ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:56:19: warning: statement should have braces [readability-inconsistent-ifelse-braces]
# | 56 | if (cond("if3")) do_something("elseif-same-line");
# | | ^
# | | {
# | 57 | else if (cond("if3")) {
# | | }
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:56:19: note: FIX-IT applied suggested code changes
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:57:3: note: FIX-IT applied suggested code changes
# | 57 | else if (cond("if3")) {
# | | ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:65:28: warning: statement should have braces [readability-inconsistent-ifelse-braces]
# | 65 | } else if (cond("if3.1")) do_something("elseif-same-line");
# | | ^
# | | {
# | 66 | else {
# | | }
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:65:28: note: FIX-IT applied suggested code changes
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:66:3: note: FIX-IT applied suggested code changes
# | 66 | else {
# | | ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:74:9: warning: statement should have braces [readability-inconsistent-ifelse-braces]
# | 74 | } else do_something("else-same-line");
# | | ^
# | | {
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:74:9: note: FIX-IT applied suggested code changes
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:74:41: note: FIX-IT applied suggested code changes
# | 74 | } else do_something("else-same-line");
# | | ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:79:25: warning: statement should have braces [readability-inconsistent-ifelse-braces]
# | 79 | if (cond("if4-outer"))
# | | ^
# | | {
# | 80 | if (cond("if4-inner"))
# | 81 | do_something("if-single-line");
# | 82 | else {
# | 83 | }
# | 84 | else {
# | | }
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:79:25: note: FIX-IT applied suggested code changes
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:84:3: note: FIX-IT applied suggested code changes
# | 84 | else {
# | | ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:80:27: warning: statement should have braces [readability-inconsistent-ifelse-braces]
# | 80 | if (cond("if4-inner"))
# | | ^
# | | {
# | 81 | do_something("if-single-line");
# | 82 | else {
# | | }
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:80:27: note: FIX-IT applied suggested code changes
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:82:5: note: FIX-IT applied suggested code changes
# | 82 | else {
# | | ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:93:19: warning: statement should have braces [readability-inconsistent-ifelse-braces]
# | 93 | if (cond("if5"))
# | | ^
# | | {
# | 94 | do_something("if-single-line");
# | 95 | else if (cond("if5")) {
# | | }
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:93:19: note: FIX-IT applied suggested code changes
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:95:3: note: FIX-IT applied suggested code changes
# | 95 | else if (cond("if5")) {
# | | ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:102:28: warning: statement should have braces [readability-inconsistent-ifelse-braces]
# | 102 | } else if (cond("if5.1"))
# | | ^
# | | {
# | 103 | do_something("elseif-single-line");
# | |
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:102:28: note: FIX-IT applied suggested code changes
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:103:42: note: FIX-IT applied suggested code changes
# | 103 | do_something("elseif-single-line");
# | | ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:108:25: warning: statement should have braces [readability-inconsistent-ifelse-braces]
# | 108 | if (MACRO_COND("if6")) MACRO_FUN;
# | | ^
# | | {
# | 109 | else {
# | | }
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:108:25: note: FIX-IT applied suggested code changes
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:109:3: note: FIX-IT applied suggested code changes
# | 109 | else {
# | | ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:116:9: warning: statement should have braces [readability-inconsistent-ifelse-braces]
# | 116 | } else MACRO_FUN;
# | | ^
# | | {
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:116:9: note: FIX-IT applied suggested code changes
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:116:20: note: FIX-IT applied suggested code changes
# | clang-tidy applied 30 of 30 suggested fixes.
# | 116 | } else MACRO_FUN;
# | | ^
# |
# | ------------------------------------------------------------------
# | diff -u /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.orig /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp failed:
# | --- /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.orig 2025-11-30 16:03:22.416429362 +0000
# | +++ /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp 2025-11-30 16:03:22.428429500 +0000
# | @@ -8,53 +8,56 @@
# |
# | // Positive tests.
# | void f() {
# | - if (cond("if0") /*comment*/) do_something("if-same-line");
# | - else {
# | + if (cond("if0") /*comment*/) { do_something("if-same-line");
# | + } else {
# | }
# | //
# | //
# | //
# |
# | if (cond("if0.1") /*comment*/) {
# | - } else do_something("else-same-line");
# | + } else { do_something("else-same-line");
# | +}
# | //
# | //
# | //
# |
# | - if (cond("if1"))
# | + if (cond("if1")) {
# | do_something("if-single-line");
# | - else {
# | + } else {
# | }
# | //
# | //
# | //
# |
# | if (cond("if1.1")) {
# | - } else
# | + } else {
# | do_something("else-single-line");
# | +}
# | //
# | //
# | //
# |
# | - if (cond("if2") /*comment*/)
# | + if (cond("if2") /*comment*/) {
# | // some comment
# | do_something("if-multi-line");
# | - else {
# | + } else {
# | }
# | //
# | //
# | //
# |
# | if (cond("if2.1") /*comment*/) {
# | - } else
# | + } else {
# | // some comment
# | do_something("else-multi-line");
# | +}
# | //
# | //
# | //
# |
# | - if (cond("if3")) do_something("elseif-same-line");
# | - else if (cond("if3")) {
# | + if (cond("if3")) { do_something("elseif-same-line");
# | + } else if (cond("if3")) {
# | } else {
# | }
# | //
# | @@ -62,8 +65,8 @@
# | //
# |
# | if (cond("if3.1")) {
# | - } else if (cond("if3.1")) do_something("elseif-same-line");
# | - else {
# | + } else if (cond("if3.1")) { do_something("elseif-same-line");
# | + } else {
# | }
# | //
# | //
# | @@ -71,17 +74,18 @@
# |
# | if (cond("if3.2")) {
# | } else if (cond("if3.2")) {
# | - } else do_something("else-same-line");
# | + } else { do_something("else-same-line");
# | +}
# | //
# | //
# | //
# |
# | - if (cond("if4-outer"))
# | - if (cond("if4-inner"))
# | + if (cond("if4-outer")) {
# | + if (cond("if4-inner")) {
# | do_something("if-single-line");
# | - else {
# | + } else {
# | }
# | - else {
# | + } else {
# | }
# | //
# | //
# | @@ -90,30 +94,32 @@
# | //
# | //
# |
# | - if (cond("if5"))
# | + if (cond("if5")) {
# | do_something("if-single-line");
# | - else if (cond("if5")) {
# | + } else if (cond("if5")) {
# | }
# | //
# | //
# | //
# |
# | if (cond("if5.1")) {
# | - } else if (cond("if5.1"))
# | + } else if (cond("if5.1")) {
# | do_something("elseif-single-line");
# | +}
# | //
# | //
# | //
# |
# | - if (MACRO_COND("if6")) MACRO_FUN;
# | - else {
# | + if (MACRO_COND("if6")) { MACRO_FUN;
# | + } else {
# | }
# | //
# | //
# | //
# |
# | if (MACRO_COND("if6")) {
# | - } else MACRO_FUN;
# | + } else { MACRO_FUN;
# | +}
# | //
# | //
# | }
# |
# | ------------------------------ Fixes -----------------------------
# | --- /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.orig 2025-11-30 16:03:22.416429362 +0000
# | +++ /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp 2025-11-30 16:03:22.428429500 +0000
# | @@ -8,53 +8,56 @@
# |
# | // Positive tests.
# | void f() {
# | - if (cond("if0") /*comment*/) do_something("if-same-line");
# | - else {
# | + if (cond("if0") /*comment*/) { do_something("if-same-line");
# | + } else {
# | }
# | //
# | //
# | //
# |
# | if (cond("if0.1") /*comment*/) {
# | - } else do_something("else-same-line");
# | + } else { do_something("else-same-line");
# | +}
# | //
# | //
# | //
# |
# | - if (cond("if1"))
# | + if (cond("if1")) {
# | do_something("if-single-line");
# | - else {
# | + } else {
# | }
# | //
# | //
# | //
# |
# | if (cond("if1.1")) {
# | - } else
# | + } else {
# | do_something("else-single-line");
# | +}
# | //
# | //
# | //
# |
# | - if (cond("if2") /*comment*/)
# | + if (cond("if2") /*comment*/) {
# | // some comment
# | do_something("if-multi-line");
# | - else {
# | + } else {
# | }
# | //
# | //
# | //
# |
# | if (cond("if2.1") /*comment*/) {
# | - } else
# | + } else {
# | // some comment
# | do_something("else-multi-line");
# | +}
# | //
# | //
# | //
# |
# | - if (cond("if3")) do_something("elseif-same-line");
# | - else if (cond("if3")) {
# | + if (cond("if3")) { do_something("elseif-same-line");
# | + } else if (cond("if3")) {
# | } else {
# | }
# | //
# | @@ -62,8 +65,8 @@
# | //
# |
# | if (cond("if3.1")) {
# | - } else if (cond("if3.1")) do_something("elseif-same-line");
# | - else {
# | + } else if (cond("if3.1")) { do_something("elseif-same-line");
# | + } else {
# | }
# | //
# | //
# | @@ -71,17 +74,18 @@
# |
# | if (cond("if3.2")) {
# | } else if (cond("if3.2")) {
# | - } else do_something("else-same-line");
# | + } else { do_something("else-same-line");
# | +}
# | //
# | //
# | //
# |
# | - if (cond("if4-outer"))
# | - if (cond("if4-inner"))
# | + if (cond("if4-outer")) {
# | + if (cond("if4-inner")) {
# | do_something("if-single-line");
# | - else {
# | + } else {
# | }
# | - else {
# | + } else {
# | }
# | //
# | //
# | @@ -90,30 +94,32 @@
# | //
# | //
# |
# | - if (cond("if5"))
# | + if (cond("if5")) {
# | do_something("if-single-line");
# | - else if (cond("if5")) {
# | + } else if (cond("if5")) {
# | }
# | //
# | //
# | //
# |
# | if (cond("if5.1")) {
# | - } else if (cond("if5.1"))
# | + } else if (cond("if5.1")) {
# | do_something("elseif-single-line");
# | +}
# | //
# | //
# | //
# |
# | - if (MACRO_COND("if6")) MACRO_FUN;
# | - else {
# | + if (MACRO_COND("if6")) { MACRO_FUN;
# | + } else {
# | }
# | //
# | //
# | //
# |
# | if (MACRO_COND("if6")) {
# | - } else MACRO_FUN;
# | + } else { MACRO_FUN;
# | +}
# | //
# | //
# | }
# |
# | ------------------------------------------------------------------
# | FileCheck -input-file=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp.msg /home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/clang-tidy/checkers/readability/inconsistent-ifelse-braces.cpp -check-prefixes=CHECK-MESSAGES -implicit-check-not={{warning|error}}: failed:
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/clang-tidy/checkers/readability/inconsistent-ifelse-braces.cpp:111:21: error: CHECK-MESSAGES: expected string not found in input
# | // CHECK-MESSAGES: :[[@LINE-3]]:20: warning: statement should have braces [readability-inconsistent-ifelse-braces]
# | ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp.msg:128:257: note: scanning from here
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:102:28: warning: statement should have braces [readability-inconsistent-ifelse-braces]
# | ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp.msg:128:257: note: with "@LINE-3" equal to "108"
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:102:28: warning: statement should have braces [readability-inconsistent-ifelse-braces]
# | ^
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp.msg:138:173: note: possible intended match here
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:108:25: warning: statement should have braces [readability-inconsistent-ifelse-braces]
# | ^
# |
# | Input file: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp.msg
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/clang-tidy/checkers/readability/inconsistent-ifelse-braces.cpp
# |
# | -dump-input=help explains the following input dump.
# |
# | Input was:
# | <<<<<<
# | .
# | .
# | .
# | 123: | }
# | 124: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:93:19: note: FIX-IT applied suggested code changes
# | 125: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:95:3: note: FIX-IT applied suggested code changes
# | 126: 95 | else if (cond("if5")) {
# | 127: | ^
# | 128: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:102:28: warning: statement should have braces [readability-inconsistent-ifelse-braces]
# | check:111'0 X error: no match found
# | check:111'1 with "@LINE-3" equal to "108"
# | 129: 102 | } else if (cond("if5.1"))
# | check:111'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 130: | ^
# | check:111'0 ~~~~~
# | 131: | {
# | check:111'0 ~~~~~
# | 132: 103 | do_something("elseif-single-line");
# | check:111'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 133: |
# | check:111'0 ~~~~
# | 134: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:102:28: note: FIX-IT applied suggested code changes
# | check:111'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 135: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:103:42: note: FIX-IT applied suggested code changes
# | check:111'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 136: 103 | do_something("elseif-single-line");
# | check:111'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 137: | ^
# | check:111'0 ~~~~~
# | 138: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp:108:25: warning: statement should have braces [readability-inconsistent-ifelse-braces]
# | check:111'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:111'2 ? possible intended match
# | 139: 108 | if (MACRO_COND("if6")) MACRO_FUN;
# | check:111'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 140: | ^
# | check:111'0 ~~~~~
# | 141: | {
# | check:111'0 ~~~~~
# | 142: 109 | else {
# | check:111'0 ~~~~~~~~~~~~~~
# | 143: | }
# | check:111'0 ~~~~~~
# | .
# | .
# | .
# | >>>>>>
# |
# `-----------------------------
# .---command stderr------------
# | Traceback (most recent call last):
# | File "/home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/../test/clang-tidy/check_clang_tidy.py", line 413, in <module>
# | main()
# | File "/home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/../test/clang-tidy/check_clang_tidy.py", line 409, in main
# | CheckRunner(args, extra_args).run()
# | File "/home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/../test/clang-tidy/check_clang_tidy.py", line 312, in run
# | self.check_messages(clang_tidy_output)
# | File "/home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/../test/clang-tidy/check_clang_tidy.py", line 273, in check_messages
# | try_run(
# | File "/home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/../test/clang-tidy/check_clang_tidy.py", line 63, in try_run
# | process_output = subprocess.check_output(args, stderr=subprocess.STDOUT).decode(
# | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# | File "/usr/lib/python3.12/subprocess.py", line 466, in check_output
# | return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
# | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# | File "/usr/lib/python3.12/subprocess.py", line 571, in run
# | raise CalledProcessError(retcode, process.args,
# | subprocess.CalledProcessError: Command '['FileCheck', '-input-file=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/clang/tools/extra/test/clang-tidy/checkers/readability/Output/inconsistent-ifelse-braces.cpp.tmp.cpp.msg', '/home/gha/actions-runner/_work/llvm-project/llvm-project/clang-tools-extra/test/clang-tidy/checkers/readability/inconsistent-ifelse-braces.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/162361
More information about the cfe-commits
mailing list