@@ -164,7 +164,7 @@ SymbolGraph::isRequirementOrDefaultImplementation(const ValueDecl *VD) const {
164164 // or a freestanding implementation from a protocol extension without
165165 // a corresponding requirement.
166166
167- auto *Proto = dyn_cast_or_null<ProtocolDecl>( DC->getSelfNominalTypeDecl () );
167+ auto *Proto = DC->getSelfProtocolDecl ( );
168168 if (!Proto) {
169169 return false ;
170170 }
@@ -185,7 +185,8 @@ SymbolGraph::isRequirementOrDefaultImplementation(const ValueDecl *VD) const {
185185 if (FoundRequirementMemberNamed (VD->getName (), Proto)) {
186186 return true ;
187187 }
188- for (auto *Inherited : Proto->getInheritedProtocols ()) {
188+
189+ for (auto *Inherited : Proto->getAllInheritedProtocols ()) {
189190 if (FoundRequirementMemberNamed (VD->getName (), Inherited)) {
190191 return true ;
191192 }
@@ -396,23 +397,18 @@ void SymbolGraph::recordConformanceSynthesizedMemberRelationships(Symbol S) {
396397
397398void
398399SymbolGraph::recordInheritanceRelationships (Symbol S) {
399- const auto VD = S.getLocalSymbolDecl ();
400- if (const auto *NTD = dyn_cast<NominalTypeDecl>(VD)) {
401- for (const auto &InheritanceLoc : NTD->getInherited ().getEntries ()) {
402- auto Ty = InheritanceLoc.getType ();
403- if (!Ty) {
404- continue ;
405- }
406- auto *InheritedTypeDecl =
407- dyn_cast_or_null<ClassDecl>(Ty->getAnyNominal ());
408- if (!InheritedTypeDecl) {
409- continue ;
410- }
400+ const auto D = S.getLocalSymbolDecl ();
411401
412- recordEdge (Symbol (this , NTD, nullptr ),
413- Symbol (this , InheritedTypeDecl, nullptr ),
414- RelationshipKind::InheritsFrom ());
415- }
402+ ClassDecl *Super = nullptr ;
403+ if (auto *CD = dyn_cast<ClassDecl>(D))
404+ Super = CD->getSuperclassDecl ();
405+ else if (auto *PD = dyn_cast<ProtocolDecl>(D))
406+ Super = PD->getSuperclassDecl ();
407+
408+ if (Super) {
409+ recordEdge (Symbol (this , cast<ValueDecl>(D), nullptr ),
410+ Symbol (this , Super, nullptr ),
411+ RelationshipKind::InheritsFrom ());
416412 }
417413}
418414
@@ -457,7 +453,7 @@ void SymbolGraph::recordDefaultImplementationRelationships(Symbol S) {
457453 if (const auto *Extension = dyn_cast<ExtensionDecl>(VD->getDeclContext ())) {
458454 if (const auto *ExtendedProtocol = Extension->getExtendedProtocolDecl ()) {
459455 HandleProtocol (ExtendedProtocol);
460- for (const auto *Inherited : ExtendedProtocol->getInheritedProtocols ()) {
456+ for (const auto *Inherited : ExtendedProtocol->getAllInheritedProtocols ()) {
461457 HandleProtocol (Inherited);
462458 }
463459 }
@@ -493,11 +489,19 @@ void SymbolGraph::recordConformanceRelationships(Symbol S) {
493489 if (const auto *NTD = dyn_cast<NominalTypeDecl>(D)) {
494490 if (auto *PD = dyn_cast<ProtocolDecl>(NTD)) {
495491 for (auto *inherited : PD->getAllInheritedProtocols ()) {
492+ // FIXME(noncopyable_generics): Figure out what we want here.
493+ if (inherited->getInvertibleProtocolKind ())
494+ continue ;
495+
496496 recordEdge (S, Symbol (this , inherited, nullptr ),
497497 RelationshipKind::ConformsTo (), nullptr );
498498 }
499499 } else {
500500 for (const auto *Conformance : NTD->getAllConformances ()) {
501+ // FIXME(noncopyable_generics): Figure out what we want here.
502+ if (Conformance->getProtocol ()->getInvertibleProtocolKind ())
503+ continue ;
504+
501505 // Check to make sure that this conformance wasn't declared via an
502506 // unconditionally-unavailable extension. If so, don't add that to the graph.
503507 if (const auto *ED = dyn_cast_or_null<ExtensionDecl>(Conformance->getDeclContext ())) {
@@ -778,6 +782,7 @@ bool SymbolGraph::isImplicitlyPrivate(const Decl *D,
778782 return false ;
779783}
780784
785+ // / FIXME: This should use AvailableAttr::isUnavailable() or similar.
781786bool SymbolGraph::isUnconditionallyUnavailableOnAllPlatforms (const Decl *D) const {
782787 return llvm::any_of (D->getAttrs (), [](const auto *Attr) {
783788 if (const auto *AvAttr = dyn_cast<AvailableAttr>(Attr)) {
0 commit comments