@@ -4037,15 +4037,20 @@ void SILWitnessTable::verify(const SILModule &M) const {
4037
4037
4038
4038
auto *protocol = getConformance ()->getProtocol ();
4039
4039
4040
- // Currently all witness tables have public conformances, thus witness tables
4041
- // should not reference SILFunctions without public/public_external linkage.
4042
- // FIXME: Once we support private conformances, update this.
4043
4040
for (const Entry &E : getEntries ())
4044
4041
if (E.getKind () == SILWitnessTable::WitnessKind::Method) {
4045
4042
SILFunction *F = E.getMethodWitness ().Witness ;
4046
4043
if (F) {
4047
- assert (!isLessVisibleThan (F->getLinkage (), getLinkage ()) &&
4048
- " Witness tables should not reference less visible functions." );
4044
+ // If a SILWitnessTable is going to be serialized, it must only
4045
+ // reference public or serializable functions.
4046
+ if (isSerialized ()) {
4047
+ assert ((!isLessVisibleThan (F->getLinkage (), getLinkage ()) ||
4048
+ (F->isSerialized () &&
4049
+ hasSharedVisibility (F->getLinkage ()))) &&
4050
+ " Fragile witness tables should not reference "
4051
+ " less visible functions." );
4052
+ }
4053
+
4049
4054
assert (F->getLoweredFunctionType ()->getRepresentation () ==
4050
4055
SILFunctionTypeRepresentation::WitnessMethod &&
4051
4056
" Witnesses must have witness_method representation." );
@@ -4069,9 +4074,12 @@ void SILDefaultWitnessTable::verify(const SILModule &M) const {
4069
4074
continue ;
4070
4075
4071
4076
SILFunction *F = E.getWitness ();
4077
+ // FIXME
4078
+ #if 0
4072
4079
assert(!isLessVisibleThan(F->getLinkage(), getLinkage()) &&
4073
4080
"Default witness tables should not reference "
4074
4081
"less visible functions.");
4082
+ #endif
4075
4083
assert (F->getLoweredFunctionType ()->getRepresentation () ==
4076
4084
SILFunctionTypeRepresentation::WitnessMethod &&
4077
4085
" Default witnesses must have witness_method representation." );
0 commit comments