[PATCH] D51229: [Sema/Attribute] Make types declared with address_space an AttributedType
Richard Smith - zygoloid via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 24 15:02:16 PDT 2018
rsmith added inline comments.
================
Comment at: lib/AST/TypePrinter.cpp:1430-1431
+ if (T->getAttrKind() == attr::AddressSpace)
+ return;
+
----------------
Please justify why this is appropriate with a comment.
================
Comment at: lib/AST/TypePrinter.cpp:1501-1502
+
+ case attr::AddressSpace:
+ llvm_unreachable("Printing of address_space is handled by the qualifier");
}
----------------
Just add this to the list starting on line 1450.
================
Comment at: lib/Sema/SemaType.cpp:7287-7294
+ if (attr.getKind() == ParsedAttr::AT_AddressSpace &&
+ !type->getAs<DependentAddressSpaceType>()) {
+ ASTContext &Ctx = state.getSema().Context;
+ auto *ASAttr = ::new (Ctx) AddressSpaceAttr(
+ attr.getRange(), Ctx, attr.getAttributeSpellingListIndex(),
+ static_cast<unsigned>(type.getQualifiers().getAddressSpace()));
+ type = state.getAttributedType(ASAttr, type, type);
----------------
This should be done in `HandleAddressSpaceTypeAttribute`, not here.
Repository:
rC Clang
https://reviews.llvm.org/D51229
More information about the cfe-commits
mailing list