[clang] [clang][sema]`no address_space attribute found at the expected location!` assertion fail (PR #216348)
Shengxin Pei via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 18 10:53:48 PDT 2026
================
@@ -6346,9 +6346,20 @@ namespace {
static void
fillDependentAddressSpaceTypeLoc(DependentAddressSpaceTypeLoc DASTL,
- const ParsedAttributesView &Attrs) {
- for (const ParsedAttr &AL : Attrs) {
- if (AL.getKind() == ParsedAttr::AT_AddressSpace) {
+ const Declarator &D,
+ const DeclaratorChunk &Chunk) {
+ // An attribute written after the declarator-id appertains to the declared
+ // entity and is applied to the outermost type rather than to a chunk, so
+ // every attribute list of the declarator has to be searched.
+ const ParsedAttributesView *AttrLists[] = {
+ &Chunk.getAttrs(), &D.getAttributes(), &D.getDeclSpec().getAttributes(),
+ &D.getDeclarationAttributes()};
+ for (const ParsedAttributesView *Attrs : AttrLists) {
+ for (const ParsedAttr &AL : *Attrs) {
+ // Invalid or malformed attributes never produce a type.
+ if (AL.getKind() != ParsedAttr::AT_AddressSpace || AL.isInvalid() ||
+ AL.getNumArgs() != 1 || !AL.isArgExpr(0))
+ continue;
----------------
TPPPP72 wrote:
What's the meaning here?
https://github.com/llvm/llvm-project/pull/216348
More information about the cfe-commits
mailing list