mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
AST: Eliminate remaining direct access to AvailableAttr's fields.
Most of the compiler should use SemanticAvailableAttr instead. In contexts like ASTDumper where a semantic attribute is unavailable use accessors on AvailableAttr. NFC.
This commit is contained in:
@@ -1361,11 +1361,10 @@ static bool isABIPlaceholderRecursive(Decl *D) {
|
||||
StringRef SDKContext::getPlatformIntroVersion(Decl *D, PlatformKind Kind) {
|
||||
if (!D)
|
||||
return StringRef();
|
||||
for (auto semanticAttr : D->getSemanticAvailableAttrs()) {
|
||||
auto attr = semanticAttr.getParsedAttr();
|
||||
auto domain = semanticAttr.getDomain();
|
||||
if (domain.getPlatformKind() == Kind && attr->Introduced) {
|
||||
return buffer(attr->Introduced->getAsString());
|
||||
for (auto attr : D->getSemanticAvailableAttrs()) {
|
||||
auto domain = attr.getDomain();
|
||||
if (domain.getPlatformKind() == Kind && attr.getIntroduced()) {
|
||||
return buffer(attr.getIntroduced()->getAsString());
|
||||
}
|
||||
}
|
||||
return StringRef();
|
||||
@@ -1374,12 +1373,11 @@ StringRef SDKContext::getPlatformIntroVersion(Decl *D, PlatformKind Kind) {
|
||||
StringRef SDKContext::getLanguageIntroVersion(Decl *D) {
|
||||
if (!D)
|
||||
return StringRef();
|
||||
for (auto semanticAttr : D->getSemanticAvailableAttrs()) {
|
||||
auto attr = semanticAttr.getParsedAttr();
|
||||
auto domain = semanticAttr.getDomain();
|
||||
for (auto attr : D->getSemanticAvailableAttrs()) {
|
||||
auto domain = attr.getDomain();
|
||||
|
||||
if (domain.isSwiftLanguage() && attr->Introduced) {
|
||||
return buffer(attr->Introduced->getAsString());
|
||||
if (domain.isSwiftLanguage() && attr.getIntroduced()) {
|
||||
return buffer(attr.getIntroduced()->getAsString());
|
||||
}
|
||||
}
|
||||
return getLanguageIntroVersion(D->getDeclContext()->getAsDecl());
|
||||
|
||||
Reference in New Issue
Block a user