Skip to content

Commit da8c77e

Browse files
committed
SIL: Don't look at stored properties of resilient structs in DestructorAnalysis::isSafeType()
1 parent 0800abf commit da8c77e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/SILOptimizer/Analysis/DestructorAnalysis.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ bool DestructorAnalysis::isSafeType(CanType Ty) {
8080
areTypeParametersSafe(Ty))
8181
return cacheResult(Ty, true);
8282

83+
// Not allowed to look at stored properties of resilient types.
84+
if (Struct->isResilient(Mod->getSwiftModule(),
85+
ResilienceExpansion::Maximal)) {
86+
return cacheResult(Ty, false);
87+
}
88+
8389
// Check the stored properties.
8490
for (auto SP : Struct->getStoredProperties()) {
8591
if (!isSafeType(SP->getInterfaceType()->getCanonicalType()))
@@ -97,6 +103,8 @@ bool DestructorAnalysis::isSafeType(CanType Ty) {
97103
}
98104

99105
// TODO: enum types.
106+
// TODO: Don't forget to check resilience of enum decl, like
107+
// we do for structs above.
100108

101109
return cacheResult(Ty, false);
102110
}

0 commit comments

Comments
 (0)