@@ -200,7 +200,7 @@ static bool mustDeserializeProtocolConformance(SILModule &M,
200
200
201
201
void SILLinkerVisitor::visitProtocolConformance (
202
202
ProtocolConformanceRef ref, const Optional<SILDeclRef> &Member) {
203
- // If an abstract protocol conformance was passed in, just return false .
203
+ // If an abstract protocol conformance was passed in, do nothing .
204
204
if (ref.isAbstract ())
205
205
return ;
206
206
@@ -211,29 +211,16 @@ void SILLinkerVisitor::visitProtocolConformance(
211
211
212
212
if (!VisitedConformances.insert (C).second )
213
213
return ;
214
-
215
- SILWitnessTable *WT = Mod.lookUpWitnessTable (C, /* deserializeLazily=*/ false );
216
-
217
- // If we don't find any witness table for the conformance, bail and return
218
- // false.
219
- if (!WT) {
220
- Mod.createWitnessTableDeclaration (C);
221
-
222
- // Adding the declaration may allow us to now deserialize the body.
223
- // Force the body if we must deserialize this witness table.
224
- if (mustDeserialize) {
225
- WT = Mod.lookUpWitnessTable (C, /* deserializeLazily=*/ true );
226
- assert (WT && WT->isDefinition ()
227
- && " unable to deserialize witness table when we must?!" );
228
- } else {
229
- return ;
230
- }
231
- }
214
+
215
+ auto *WT = Mod.lookUpWitnessTable (C, mustDeserialize);
232
216
233
217
// If the looked up witness table is a declaration, there is nothing we can
234
- // do here. Just bail and return false.
235
- if (WT->isDeclaration ())
218
+ // do here.
219
+ if (WT == nullptr || WT->isDeclaration ()) {
220
+ assert (!mustDeserialize &&
221
+ " unable to deserialize witness table when we must?!" );
236
222
return ;
223
+ }
237
224
238
225
auto maybeVisitRelatedConformance = [&](ProtocolConformanceRef c) {
239
226
// Formally all conformances referenced by a used conformance are used.
0 commit comments