mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
ABI checker: diagnose the missing of @available attributes for added ABIs
New ABIs should have an @available attribute to describe the introducing version. This patch teaches the tool to diagnose its missing. Decls with @_AlwaysEmitIntoClient are excluded from the blaming lists since they are essentially available all the time. rdar://51089418
This commit is contained in:
@@ -1145,6 +1145,8 @@ static bool isABIPlaceholderRecursive(Decl *D) {
|
||||
}
|
||||
|
||||
StringRef SDKContext::getPlatformIntroVersion(Decl *D, PlatformKind Kind) {
|
||||
if (!D)
|
||||
return StringRef();
|
||||
for (auto *ATT: D->getAttrs()) {
|
||||
if (auto *AVA = dyn_cast<AvailableAttr>(ATT)) {
|
||||
if (AVA->Platform == Kind && AVA->Introduced) {
|
||||
@@ -1152,10 +1154,12 @@ StringRef SDKContext::getPlatformIntroVersion(Decl *D, PlatformKind Kind) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return StringRef();
|
||||
return getPlatformIntroVersion(D->getDeclContext()->getAsDecl(), Kind);
|
||||
}
|
||||
|
||||
StringRef SDKContext::getLanguageIntroVersion(Decl *D) {
|
||||
if (!D)
|
||||
return StringRef();
|
||||
for (auto *ATT: D->getAttrs()) {
|
||||
if (auto *AVA = dyn_cast<AvailableAttr>(ATT)) {
|
||||
if (AVA->isLanguageVersionSpecific() && AVA->Introduced) {
|
||||
@@ -1163,7 +1167,7 @@ StringRef SDKContext::getLanguageIntroVersion(Decl *D) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return StringRef();
|
||||
return getLanguageIntroVersion(D->getDeclContext()->getAsDecl());
|
||||
}
|
||||
|
||||
SDKNodeInitInfo::SDKNodeInitInfo(SDKContext &Ctx, Type Ty, TypeInitInfo Info) :
|
||||
|
||||
Reference in New Issue
Block a user