mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
swift-module-digester: include non-resilient class decls when checking ABI stability.
This commit is contained in:
@@ -90,4 +90,7 @@ public extension P1 {
|
||||
infix operator ..*..
|
||||
|
||||
@usableFromInline
|
||||
class UsableFromInlineClass {}
|
||||
@_fixed_layout
|
||||
class UsableFromInlineClass {
|
||||
private var Prop = 1
|
||||
}
|
||||
|
||||
@@ -319,6 +319,7 @@
|
||||
"ReferenceOwnership"
|
||||
],
|
||||
"ownership": 1,
|
||||
"fixedbinaryorder": 0,
|
||||
"hasStorage": true
|
||||
},
|
||||
{
|
||||
@@ -385,6 +386,7 @@
|
||||
"ReferenceOwnership"
|
||||
],
|
||||
"ownership": 2,
|
||||
"fixedbinaryorder": 1,
|
||||
"hasStorage": true
|
||||
},
|
||||
{
|
||||
@@ -1219,6 +1221,49 @@
|
||||
"name": "UsableFromInlineClass",
|
||||
"printedName": "UsableFromInlineClass",
|
||||
"children": [
|
||||
{
|
||||
"kind": "Var",
|
||||
"name": "Prop",
|
||||
"printedName": "Prop",
|
||||
"children": [
|
||||
{
|
||||
"kind": "TypeNominal",
|
||||
"name": "Int",
|
||||
"printedName": "Int",
|
||||
"usr": "s:Si"
|
||||
},
|
||||
{
|
||||
"kind": "Getter",
|
||||
"name": "_",
|
||||
"printedName": "_()",
|
||||
"children": [
|
||||
{
|
||||
"kind": "TypeNominal",
|
||||
"name": "Int",
|
||||
"printedName": "Int",
|
||||
"usr": "s:Si"
|
||||
}
|
||||
],
|
||||
"declKind": "Accessor",
|
||||
"usr": "s:4cake21UsableFromInlineClassC4Prop33_3D8926C30F7417F2EF9A277D0C73FBDBLLSivg",
|
||||
"moduleName": "cake",
|
||||
"implicit": true,
|
||||
"isInternal": true,
|
||||
"declAttributes": [
|
||||
"Transparent"
|
||||
]
|
||||
}
|
||||
],
|
||||
"declKind": "Var",
|
||||
"usr": "s:4cake21UsableFromInlineClassC4Prop33_3D8926C30F7417F2EF9A277D0C73FBDBLLSivp",
|
||||
"moduleName": "cake",
|
||||
"isInternal": true,
|
||||
"declAttributes": [
|
||||
"HasInitialValue"
|
||||
],
|
||||
"fixedbinaryorder": 0,
|
||||
"hasStorage": true
|
||||
},
|
||||
{
|
||||
"kind": "Constructor",
|
||||
"name": "init",
|
||||
@@ -1242,6 +1287,7 @@
|
||||
"usr": "s:4cake21UsableFromInlineClassC",
|
||||
"moduleName": "cake",
|
||||
"declAttributes": [
|
||||
"FixedLayout",
|
||||
"UsableFromInline"
|
||||
]
|
||||
},
|
||||
|
||||
@@ -363,6 +363,7 @@
|
||||
"ReferenceOwnership"
|
||||
],
|
||||
"ownership": 1,
|
||||
"fixedbinaryorder": 0,
|
||||
"hasStorage": true
|
||||
},
|
||||
{
|
||||
@@ -429,6 +430,7 @@
|
||||
"ReferenceOwnership"
|
||||
],
|
||||
"ownership": 2,
|
||||
"fixedbinaryorder": 1,
|
||||
"hasStorage": true
|
||||
},
|
||||
{
|
||||
|
||||
@@ -989,11 +989,12 @@ static StringRef printGenericSignature(SDKContext &Ctx, Decl *D) {
|
||||
}
|
||||
|
||||
static Optional<uint8_t> getFixedBinaryOrder(ValueDecl *VD) {
|
||||
auto D = VD->getDeclContext()->getAsDecl();
|
||||
if (!D)
|
||||
auto *NTD = dyn_cast_or_null<NominalTypeDecl>(VD->getDeclContext()->getAsDecl());
|
||||
|
||||
if (!NTD || isa<ProtocolDecl>(NTD))
|
||||
return None;
|
||||
|
||||
if (auto *ED = dyn_cast<EnumDecl>(D)) {
|
||||
if (auto *ED = dyn_cast<EnumDecl>(NTD)) {
|
||||
auto Check = [](Decl *M) {
|
||||
return isa<EnumElementDecl>(M);
|
||||
};
|
||||
@@ -1003,21 +1004,20 @@ static Optional<uint8_t> getFixedBinaryOrder(ValueDecl *VD) {
|
||||
assert(End != Members.end());
|
||||
return std::count_if(Members.begin(), End, Check);
|
||||
}
|
||||
return None;
|
||||
}
|
||||
if (auto *SD = dyn_cast<StructDecl>(D)) {
|
||||
auto Check = [](Decl *M) {
|
||||
if (auto *STD = dyn_cast<AbstractStorageDecl>(M)) {
|
||||
return STD->hasStorage() && !STD->isStatic();
|
||||
}
|
||||
return false;
|
||||
};
|
||||
if (!SD->isResilient() && Check(VD)) {
|
||||
auto Members = SD->getMembers();
|
||||
if (!NTD->isResilient() && Check(VD)) {
|
||||
auto Members = NTD->getMembers();
|
||||
auto End = std::find(Members.begin(), Members.end(), VD);
|
||||
assert(End != Members.end());
|
||||
return std::count_if(Members.begin(), End, Check);
|
||||
}
|
||||
}
|
||||
return llvm::None;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user