@@ -191,15 +191,6 @@ SymbolGraph::isRequirementOrDefaultImplementation(const ValueDecl *VD) const {
191191// MARK: - Symbols (Nodes)
192192
193193void SymbolGraph::recordNode (Symbol S) {
194- if (Walker.Options .SkipProtocolImplementations && S.getInheritedDecl ()) {
195- const auto *DocCommentProvidingDecl =
196- getDocCommentProvidingDecl (S.getLocalSymbolDecl (), /* AllowSerialized=*/ true );
197-
198- // allow implementation symbols to remain if they have their own comment
199- if (DocCommentProvidingDecl != S.getLocalSymbolDecl ())
200- return ;
201- }
202-
203194 Nodes.insert (S);
204195
205196 // Record all of the possible relationships (edges) originating
@@ -637,6 +628,19 @@ SymbolGraph::serializeDeclarationFragments(StringRef Key, Type T,
637628 T->print (Printer, Options);
638629}
639630
631+ namespace {
632+
633+ const ValueDecl *getProtocolRequirement (const ValueDecl *VD) {
634+ auto reqs = VD->getSatisfiedProtocolRequirements ();
635+
636+ if (!reqs.empty ())
637+ return reqs.front ();
638+ else
639+ return nullptr ;
640+ }
641+
642+ }
643+
640644bool SymbolGraph::isImplicitlyPrivate (const Decl *D,
641645 bool IgnoreContext) const {
642646 // Don't record unconditionally private declarations
@@ -698,6 +702,15 @@ bool SymbolGraph::isImplicitlyPrivate(const Decl *D,
698702
699703 // Special cases below.
700704
705+ // If we've been asked to skip protocol implementations, filter them out here.
706+ if (Walker.Options .SkipProtocolImplementations && getProtocolRequirement (VD)) {
707+ // Allow them to stay if they have their own doc comment
708+ const auto *DocCommentProvidingDecl =
709+ getDocCommentProvidingDecl (VD, /* AllowSerialized=*/ true );
710+ if (DocCommentProvidingDecl != VD)
711+ return true ;
712+ }
713+
701714 // Symbols from exported-imported modules should only be included if they
702715 // were originally public.
703716 if (Walker.isFromExportedImportedModule (D) &&
0 commit comments