[clang] Fix crash when an attribute is applied to pragma attribute/pragma dump (PR #137880)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 30 06:26:22 PDT 2025


================
@@ -526,10 +526,14 @@ StmtResult Parser::ParseStatementOrDeclarationAfterAttributes(
     return ParsePragmaLoopHint(Stmts, StmtCtx, TrailingElseLoc, CXX11Attrs);
 
   case tok::annot_pragma_dump:
+    ProhibitAttributes(CXX11Attrs);
----------------
erichkeane wrote:

No, both of those successfully produce a `statement` out of this, so they won't assert.  So any attributes you try to apply will either be valid, or fail because they don't apply to a statement.

The difference in these two is that they don't result in either an error OR a valid statement.

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


More information about the cfe-commits mailing list