[clang-tools-extra] [clang-tidy] Ignore label-like statements when checking if/else bodies (PR #202869)

Gaurav Dhingra via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 10 00:02:40 PDT 2026


================
@@ -0,0 +1,126 @@
+// RUN: %check_clang_tidy -std=c++98-or-later %s readability-inconsistent-ifelse-braces %t
----------------
gxyd wrote:

There is an existing test file `inconsistent-ifelse-braces-attributes.cpp` which is dedicated towards testing only for "attributes", but that file uses `-std=c++20-or-later` for all the tests. Since the attributes `likely / unlikely` were introduced in C++20 (see: https://en.cppreference.com/cpp/language/attributes/likely) it makes sense to have it that way.

So the question is: should I just use a single test file to have all the tests, including the ones present in `inconsistent-ifelse-braces-attributes.cpp` and the newly added tests in this PR, and name the file `inconsistent-ifelse-braces-label-like.cpp` and test with c++20-or-later?

Or should I separate the tests into two test files, one with c++98-or-later and one with c++20-or-later?

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


More information about the cfe-commits mailing list