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:
Xi Ge
2019-05-28 16:04:24 -07:00
parent 05bec0c3e3
commit f55d3ad029
9 changed files with 53 additions and 3 deletions

View File

@@ -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) :