AST: Enumerate expanded attributes in TypeCheckAttr.

We need to avoid triggering semantic attribute requests in TypeCheckAttr
because it happens too early in type checking to trigger some semantic
attribute requests, and we only want to diagnose attributes that were written
in source anyways.
This commit is contained in:
Allan Shortlidge
2023-11-01 09:52:59 -07:00
parent 040e7a71dd
commit b4c5cfd536
7 changed files with 11 additions and 12 deletions

View File

@@ -375,13 +375,12 @@ OrigDeclAttributes Decl::getOriginalAttrs() const {
return OrigDeclAttributes(getAttrs(), this);
}
DeclAttributes::AttributeKindRange<CustomAttr, false>
Decl::getSemanticCustomAttrs() const {
DeclAttributes Decl::getExpandedAttrs() const {
auto mutableThis = const_cast<Decl *>(this);
(void)evaluateOrDefault(getASTContext().evaluator,
ExpandMemberAttributeMacros{mutableThis}, {});
return getAttrs().getAttributes<CustomAttr>();
return getAttrs();
}
DeclAttributes Decl::getSemanticAttrs() const {
@@ -447,7 +446,7 @@ void Decl::visitAuxiliaryDecls(
void Decl::forEachAttachedMacro(MacroRole role,
MacroCallback macroCallback) const {
for (auto customAttrConst : getSemanticCustomAttrs()) {
for (auto customAttrConst : getExpandedAttrs().getAttributes<CustomAttr>()) {
auto customAttr = const_cast<CustomAttr *>(customAttrConst);
auto *macroDecl = getResolvedMacro(customAttr);