mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user