swift-module-digester: non-final methods in fixed-layout classes no longer have fixed orders. rdar://46617463

This commit is contained in:
Xi Ge
2018-12-12 10:47:44 -08:00
parent 115922304e
commit 6fac47e7e6
3 changed files with 2 additions and 19 deletions

View File

@@ -1073,30 +1073,17 @@ Optional<uint8_t> SDKContext::getFixedBinaryOrder(ValueDecl *VD) const {
}
return false;
};
// The relative order of non-final instance functions matters for non-resilient
// class.
auto isNonfinalFunc = [](Decl *M) {
if (auto *FD = dyn_cast<FuncDecl>(M)) {
return !isa<AccessorDecl>(FD) && !FD->isFinal();
}
return false;
};
switch (NTD->getKind()) {
case DeclKind::Enum: {
return getSimilarMemberCount(NTD, VD, [](Decl *M) {
return isa<EnumElementDecl>(M);
});
}
case DeclKind::Class:
case DeclKind::Struct: {
return getSimilarMemberCount(NTD, VD, isStored);
}
case DeclKind::Class: {
if (auto count = getSimilarMemberCount(NTD, VD, isStored)) {
return count;
} else {
return getSimilarMemberCount(NTD, VD, isNonfinalFunc);
}
}
default:
llvm_unreachable("bad nominal type kind.");
}