[clang-tools-extra] [clang-tidy] Correctly handle attributes in readability-inconsistent-ifelse-braces (PR #184095)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 5 06:22:21 PST 2026
================
@@ -127,12 +127,24 @@ BraceInsertionHints getBraceInsertionsHints(const Stmt *const S,
if (StartLoc.isInvalid())
return {};
+ const Stmt *InnerS = S;
+ while (const auto *AS = dyn_cast<AttributedStmt>(InnerS))
----------------
zeyi2 wrote:
> AttributedStmt be a substatement of a AttributedStmt
I couldn't find a way to produce a case like this. I use `while` initially for safety (e.g. the util function still works as expected when giving a "weird" input). But I think since parser merges attributes into a single `AttributedStmt` node, I think it is fine to replace the `while` to `if` :)
https://github.com/llvm/llvm-project/pull/184095
More information about the cfe-commits
mailing list