Skip to content

Commit 6c04a7a

Browse files
committed
SILGen: Lazily emit ClangImporter-synthesized conformances even when they're incomplete
Currently Sema completes all _ObjectiveCBridgeable conformances it thinks are needed in SILGen and runtime dynamic casts, but that's about to change. When emitting conformances for an imported type we would skip incomplete conformances. Now that we have a long-lived type checker instance, there is no longer any reason to do that. Looking up witnesses from an incomplete conformance will trigger conformance checking as needed. Furthermore, conformances emitted in this path are emitted lazily, so if a conformance is not used, no conformance checking will take place. A change in behavior only occurs after subsequent changes to remove Sema's eager checking of ClangImporter-synthesized _ObjectiveCBridgeable conformances; at that point, we must be prepared to lazily emit these incomplete conformances.
1 parent 400063e commit 6c04a7a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/SILGen/SILGenDecl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,9 +1440,9 @@ void SILGenModule::emitExternalDefinition(Decl *d) {
14401440
nullptr)) {
14411441
auto *proto = c->getProtocol();
14421442
if (Lowering::TypeConverter::protocolRequiresWitnessTable(proto) &&
1443-
isa<NormalProtocolConformance>(c) &&
1444-
c->isComplete())
1443+
isa<NormalProtocolConformance>(c)) {
14451444
emitExternalWitnessTable(cast<NormalProtocolConformance>(c));
1445+
}
14461446
}
14471447
break;
14481448
}

0 commit comments

Comments
 (0)