@@ -7659,31 +7659,35 @@ void SILVTable::verify(const SILModule &M) const {
76597659}
76607660
76617661// / Verify that a witness table follows invariants.
7662- void SILWitnessTable::verify (const SILModule &M ) const {
7663- if (!verificationEnabled (M ))
7662+ void SILWitnessTable::verify (const SILModule &mod ) const {
7663+ if (!verificationEnabled (mod ))
76647664 return ;
76657665
76667666 if (isDeclaration ())
76677667 assert (getEntries ().empty () &&
76687668 " A witness table declaration should not have any entries." );
76697669
7670- for (const Entry &E : getEntries ())
7671- if (E.getKind () == SILWitnessTable::WitnessKind::Method) {
7672- SILFunction *F = E.getMethodWitness ().Witness ;
7673- if (F) {
7674- // If a SILWitnessTable is going to be serialized, it must only
7675- // reference public or serializable functions.
7676- if (isAnySerialized ()) {
7677- assert (F->hasValidLinkageForFragileRef (getSerializedKind ()) &&
7678- " Fragile witness tables should not reference "
7679- " less visible functions." );
7680- }
7670+ for (const Entry &entry : getEntries ()) {
7671+ if (entry.getKind () != SILWitnessTable::WitnessKind::Method)
7672+ continue ;
76817673
7682- assert (F->getLoweredFunctionType ()->getRepresentation () ==
7683- SILFunctionTypeRepresentation::WitnessMethod &&
7684- " Witnesses must have witness_method representation." );
7685- }
7674+ auto *witnessFunction = entry.getMethodWitness ().Witness ;
7675+ if (!witnessFunction)
7676+ continue ;
7677+
7678+ // If a SILWitnessTable is going to be serialized, it must only
7679+ // reference public or serializable functions.
7680+ if (isAnySerialized ()) {
7681+ assert (
7682+ witnessFunction->hasValidLinkageForFragileRef (getSerializedKind ()) &&
7683+ " Fragile witness tables should not reference "
7684+ " less visible functions." );
76867685 }
7686+
7687+ assert (witnessFunction->getLoweredFunctionType ()->getRepresentation () ==
7688+ SILFunctionTypeRepresentation::WitnessMethod &&
7689+ " Witnesses must have witness_method representation." );
7690+ }
76877691}
76887692
76897693// / Verify that a default witness table follows invariants.
0 commit comments