[clang] [clang][Parser] Warn when the body of expansion statement is not a compound statement (PR #209229)
Corentin Jabot via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 15 07:20:50 PDT 2026
================
@@ -2379,6 +2382,11 @@ StmtResult Parser::ParseForStatement(SourceLocation *TrailingElseLoc,
return StmtError();
}
+ // attribute-specifier without attribute (`[[]]`) isn't in AST.
+ // `__declspec()` is only applied to declarations, so we can ignore it.
+ if (!isa<CompoundStmt>(Body.get()) || BodyStartsWithAttr)
----------------
cor3ntin wrote:
I mean, our logic could actually warn by checking the next token is `{` - that cover all the cases, i think
https://eel.is/c++draft/stmt.block#nt:compound-statement
https://github.com/llvm/llvm-project/pull/209229
More information about the cfe-commits
mailing list