Skip to content

Commit b54c619

Browse files
committed
Support unavailable and obsoleted attributes on extensions
Members of an extension inherit the availability of the extension. This was previously supported for introduced and deprecated, but not unavailable and obsoleted. rdar://problem/50949936
1 parent 8221c67 commit b54c619

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/AST/Attr.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,14 @@ AvailableVersionComparison AvailableAttr::getVersionAvailability(
10621062

10631063
const AvailableAttr *AvailableAttr::isUnavailable(const Decl *D) {
10641064
ASTContext &ctx = D->getASTContext();
1065-
return D->getAttrs().getUnavailable(ctx);
1065+
if (auto attr = D->getAttrs().getUnavailable(ctx))
1066+
return attr;
1067+
1068+
// If D is an extension member, check if the extension is unavailable.
1069+
if (auto ext = dyn_cast<ExtensionDecl>(D->getDeclContext()))
1070+
return AvailableAttr::isUnavailable(ext);
1071+
1072+
return nullptr;
10661073
}
10671074

10681075
SpecializeAttr::SpecializeAttr(SourceLoc atLoc, SourceRange range,

0 commit comments

Comments
 (0)