@@ -7659,31 +7659,35 @@ void SILVTable::verify(const SILModule &M) const {
7659
7659
}
7660
7660
7661
7661
// / 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 ))
7664
7664
return ;
7665
7665
7666
7666
if (isDeclaration ())
7667
7667
assert (getEntries ().empty () &&
7668
7668
" A witness table declaration should not have any entries." );
7669
7669
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 ;
7681
7673
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." );
7686
7685
}
7686
+
7687
+ assert (witnessFunction->getLoweredFunctionType ()->getRepresentation () ==
7688
+ SILFunctionTypeRepresentation::WitnessMethod &&
7689
+ " Witnesses must have witness_method representation." );
7690
+ }
7687
7691
}
7688
7692
7689
7693
// / Verify that a default witness table follows invariants.
0 commit comments