swift-module-digester: include unavailable variables with fixed layout order when checking ABI stability.

This commit is contained in:
Xi Ge
2018-10-01 15:02:38 -07:00
parent e5e61d4b25
commit b3614a4b6f
3 changed files with 56 additions and 8 deletions

View File

@@ -1200,6 +1200,17 @@ SwiftDeclCollector::constructInitNode(ConstructorDecl *CD) {
bool swift::ide::api::
SwiftDeclCollector::shouldIgnore(Decl *D, const Decl* Parent) {
if (Ctx.checkingABI()) {
if (auto *VD = dyn_cast<ValueDecl>(D)) {
// Private vars with fixed binary orders can have ABI-impact, so we should
// whitelist them if we're checking ABI.
if (getFixedBinaryOrder(VD).hasValue())
return false;
// Typealias should have no impact on ABI.
if (isa<TypeAliasDecl>(VD))
return true;
}
}
if (D->isPrivateStdlibDecl(false))
return true;
if (AvailableAttr::isUnavailable(D))
@@ -1209,18 +1220,10 @@ SwiftDeclCollector::shouldIgnore(Decl *D, const Decl* Parent) {
if (auto VD = dyn_cast<ValueDecl>(D)) {
if (VD->getBaseName().empty())
return true;
// Exclude type alias decls because they should have no impact on ABI.
if (isa<TypeAliasDecl>(VD) && Ctx.checkingABI())
return true;
switch (VD->getFormalAccess()) {
case AccessLevel::Internal:
case AccessLevel::Private:
case AccessLevel::FilePrivate:
// Private vars with fixed binary orders can have ABI-impact, so we should
// whitelist them if we're checking ABI.
if (Ctx.checkingABI() && getFixedBinaryOrder(VD).hasValue())
break;
return true;
case AccessLevel::Public:
case AccessLevel::Open: