Skip to content

Commit 0c9478c

Browse files
committed
Don't print inherited, synthesized protocols
1 parent 0a45bac commit 0c9478c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/Frontend/ModuleInterfaceSupport.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,8 @@ class InheritedProtocolCollector {
358358
/// For each type in \p directlyInherited, classify the protocols it refers to
359359
/// as included for printing or not, and record them in the appropriate
360360
/// vectors.
361-
void recordProtocols(ArrayRef<TypeLoc> directlyInherited, const Decl *D) {
361+
void recordProtocols(ArrayRef<TypeLoc> directlyInherited, const Decl *D,
362+
bool skipSynthesized = false) {
362363
Optional<AvailableAttrList> availableAttrs;
363364

364365
for (TypeLoc inherited : directlyInherited) {
@@ -379,6 +380,9 @@ class InheritedProtocolCollector {
379380
// any of those besides 'AnyObject'.
380381
}
381382

383+
if (skipSynthesized)
384+
return;
385+
382386
// Check for synthesized protocols, like Hashable on enums.
383387
if (auto *nominal = dyn_cast<NominalTypeDecl>(D)) {
384388
SmallVector<ProtocolConformance *, 4> localConformances =
@@ -456,7 +460,8 @@ class InheritedProtocolCollector {
456460
if (auto *CD = dyn_cast<ClassDecl>(D)) {
457461
for (auto *SD = CD->getSuperclassDecl(); SD;
458462
SD = SD->getSuperclassDecl()) {
459-
map[nominal].recordProtocols(SD->getInherited(), SD);
463+
map[nominal].recordProtocols(
464+
SD->getInherited(), SD, /*skipSynthesized=*/true);
460465
for (auto *Ext: SD->getExtensions()) {
461466
if (shouldInclude(Ext)) {
462467
map[nominal].recordProtocols(Ext->getInherited(), Ext);

0 commit comments

Comments
 (0)