Skip to content

Commit a801ac3

Browse files
committed
AST: Re-implement ProtocolDecl::inheritsFrom() to use getAllInheritedProtocols()
1 parent 443919a commit a801ac3

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

lib/AST/Decl.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6608,18 +6608,12 @@ bool ProtocolDecl::walkInheritedProtocols(
66086608
bool ProtocolDecl::inheritsFrom(const ProtocolDecl *super) const {
66096609
assert(super);
66106610

6611+
// Fast path.
66116612
if (this == super)
66126613
return false;
66136614

6614-
if (auto ip = super->getInvertibleProtocolKind())
6615-
return requiresInvertible(*ip);
6616-
6617-
return walkInheritedProtocols([super](ProtocolDecl *inherited) {
6618-
if (inherited == super)
6619-
return TypeWalker::Action::Stop;
6620-
6621-
return TypeWalker::Action::Continue;
6622-
});
6615+
auto allInherited = getAllInheritedProtocols();
6616+
return (llvm::find(allInherited, super) != allInherited.end());
66236617
}
66246618

66256619
static void findInheritedType(

0 commit comments

Comments
 (0)