[Serialization] Drop inherited conformances on classes (#23347)

These can be recreated if needed in a client library. To do this, I've
added a new ConformanceLookupKind::NonInherited, which can also be
used elsewhere in the project where we're already filtering out
inherited conformances some other way.

Note that this doesn't drop inherited conformances from the entire
serialized interface, just from the list that a class explicitly
declares. They still get referenced sometimes.

rdar://problem/50541451 and possibly others
This commit is contained in:
Jordan Rose
2019-05-13 13:41:10 -07:00
committed by GitHub
parent c648a71ef6
commit c506747a9c
7 changed files with 34 additions and 11 deletions

View File

@@ -989,10 +989,30 @@ void ConformanceLookupTable::lookupConformances(
return true;
// If we are to filter out this result, do so now.
if (lookupKind == ConformanceLookupKind::OnlyExplicit &&
entry->getKind() != ConformanceEntryKind::Explicit &&
entry->getKind() != ConformanceEntryKind::Synthesized)
return false;
switch (lookupKind) {
case ConformanceLookupKind::OnlyExplicit:
switch (entry->getKind()) {
case ConformanceEntryKind::Explicit:
case ConformanceEntryKind::Synthesized:
break;
case ConformanceEntryKind::Implied:
case ConformanceEntryKind::Inherited:
return false;
}
break;
case ConformanceLookupKind::NonInherited:
switch (entry->getKind()) {
case ConformanceEntryKind::Explicit:
case ConformanceEntryKind::Synthesized:
case ConformanceEntryKind::Implied:
break;
case ConformanceEntryKind::Inherited:
return false;
}
break;
case ConformanceLookupKind::All:
break;
}
// Record the protocol.
if (protocols)