================
@@ -231,6 +231,11 @@ StmtResult
Parser::ParseStatementOrDeclarationAfterAttributes(
GNUAttrs.Range.getBegin());
} else if (GNUAttrs.Range.getBegin().isValid())
DeclStart = GNUAttrs.Range.getBegin();
+ // A declaration that declares nothing (`int;`) yields no Decl but still
+ // occupies the statement position; unlike a pragma, ParseStatement()
must
+ // not skip it.
+ if (!Decl)
+ return Actions.ActOnNullStmt(PrevTokLocation);
----------------
akash-manna-sky wrote:
I tried `EmptyDecl`, but it can't appear inside a function or class today. An
invalid unnamed decl would make any struct containing `int;` invalid
(`ActOnFields`), and CodeGen doesn't expect invalid decls since `int;` only
warns. So I'd like to keep this PR as the crash fix.
https://github.com/llvm/llvm-project/pull/224682
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits