================
@@ -4987,15 +5130,23 @@ void Parser::ParseStructUnionBody(SourceLocation
RecordLoc,
ParsedAttributes attrs(AttrFactory);
// If attributes exist after struct contents, parse them.
- MaybeParseGNUAttributes(attrs, &LateFieldAttrs);
+ MaybeParseGNUAttributes(attrs);
// Late parse field attributes if necessary.
ParseLexedCAttributeList(LateFieldAttrs, /*EnterScope=*/false);
-
SmallVector<Decl *, 32> FieldDecls(TagDecl->fields());
Actions.ActOnFields(getCurScope(), RecordLoc, TagDecl, FieldDecls,
T.getOpenLocation(), T.getCloseLocation(), attrs);
+ Scope *ParentScope = getCurScope()->getParent();
+ assert(ParentScope);
+ // Process late-parsed type attributes for the outermost record. Nested
+ // non-anonymous records are handled immediately after their declaration is
+ // parsed, which is when it is known whether the record is anonymous.
+ if (getLangOpts().ExperimentalLateParseAttributes &&
+ !ParentScope->getEntity()->isRecord())
----------------
zmodem wrote:
It looks like Scope::getEntity() can return nullptr, which is why
clang/test/C/C23/n3037.c is failing the CI checks.
https://github.com/llvm/llvm-project/pull/179612
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits