Skip to content

Commit 4a0f9ca

Browse files
committed
[SILGen] TypeWrappers: force emission of wrapper initializer
Make sure that wrapper's initializer is always emitted because it could be used by DI and IRGen later on to aid in `_storage` initialization.
1 parent d1bb5ad commit 4a0f9ca

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/SILGen/SILGenType.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,6 +1115,14 @@ class SILGenType : public TypeMemberVisitor<SILGenType> {
11151115
if (auto *normal = dyn_cast<NormalProtocolConformance>(conformance))
11161116
SGM.getWitnessTable(normal);
11171117
}
1118+
1119+
// Emit `init(for:storage)` initializer as it would be used
1120+
// by DI and IRGen later on.
1121+
if (auto typeWrapperInfo = theType->getTypeWrapper()) {
1122+
auto *ctor = typeWrapperInfo->Wrapper->getTypeWrapperInitializer();
1123+
assert(ctor);
1124+
(void)SGM.getFunction(SILDeclRef(ctor), NotForDefinition);
1125+
}
11181126
}
11191127

11201128
//===--------------------------------------------------------------------===//

0 commit comments

Comments
 (0)