@@ -3564,15 +3564,10 @@ void AttributeChecker::visitCustomAttr(CustomAttr *attr) {
35643564 auto dc = D->getDeclContext ();
35653565
35663566 // Figure out which nominal declaration this custom attribute refers to.
3567- auto found = evaluateOrDefault (
3568- Ctx.evaluator , CustomAttrDeclRequest {attr, dc}, nullptr );
3567+ auto *nominal = evaluateOrDefault (
3568+ Ctx.evaluator , CustomAttrNominalRequest {attr, dc}, nullptr );
35693569
3570- NominalTypeDecl *nominal = nullptr ;
3571- if (found) {
3572- nominal = found.dyn_cast <NominalTypeDecl *>();
3573- }
3574-
3575- if (!found) {
3570+ if (!nominal) {
35763571 // Try resolving an attached macro attribute.
35773572 auto *macro = evaluateOrDefault (
35783573 Ctx.evaluator , ResolveAttachedMacroRequest{attr, dc}, nullptr );
@@ -7426,15 +7421,12 @@ static void forEachCustomAttribute(
74267421 for (auto *attr : decl->getAttrs ().getAttributes <CustomAttr>()) {
74277422 auto *mutableAttr = const_cast <CustomAttr *>(attr);
74287423
7429- auto found = evaluateOrDefault (
7424+ auto *nominal = evaluateOrDefault (
74307425 ctx.evaluator ,
7431- CustomAttrDeclRequest{mutableAttr, decl->getDeclContext ()}, nullptr );
7432- if (!found)
7433- continue ;
7426+ CustomAttrNominalRequest{mutableAttr, decl->getDeclContext ()}, nullptr );
74347427
7435- auto nominal = found.dyn_cast <NominalTypeDecl *>();
74367428 if (!nominal)
7437- continue ; // FIXME: add another entry point for macros we've found
7429+ continue ;
74387430
74397431 if (nominal->getAttrs ().hasAttribute <ATTR>())
74407432 fn (mutableAttr, nominal);
0 commit comments