Skip to content

Commit 6c0ca54

Browse files
committed
AST: Remove unused ProtocolType::visitAllProtocols()
1 parent 236d22c commit 6c0ca54

File tree

2 files changed

+0
-41
lines changed

2 files changed

+0
-41
lines changed

include/swift/AST/Types.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5926,16 +5926,6 @@ class ProtocolType : public NominalType {
59265926
/// in the protocol list, then sorting them in some stable order.
59275927
static void canonicalizeProtocols(SmallVectorImpl<ProtocolDecl *> &protocols);
59285928

5929-
/// Visit all of the protocols in the given list of protocols, along with their
5930-
///
5931-
/// \param fn Visitor function called for each protocol (just once). If it
5932-
/// returns \c true, the visit operation will abort and return \c true.
5933-
///
5934-
/// \returns \c true if any invocation of \c fn returns \c true, and \c false
5935-
/// otherwise.
5936-
static bool visitAllProtocols(ArrayRef<ProtocolDecl *> protocols,
5937-
llvm::function_ref<bool(ProtocolDecl *)> fn);
5938-
59395929
private:
59405930
friend class NominalTypeDecl;
59415931
ProtocolType(ProtocolDecl *TheDecl, Type Parent, const ASTContext &Ctx,

lib/AST/Type.cpp

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,37 +1501,6 @@ static void addProtocols(Type T,
15011501
Superclass = T;
15021502
}
15031503

1504-
bool ProtocolType::visitAllProtocols(
1505-
ArrayRef<ProtocolDecl *> protocols,
1506-
llvm::function_ref<bool(ProtocolDecl *)> fn) {
1507-
SmallVector<ProtocolDecl *, 4> stack;
1508-
SmallPtrSet<ProtocolDecl *, 4> knownProtocols;
1509-
1510-
// Prepopulate the stack.
1511-
for (auto proto : protocols) {
1512-
if (knownProtocols.insert(proto).second)
1513-
stack.push_back(proto);
1514-
}
1515-
std::reverse(stack.begin(), stack.end());
1516-
1517-
while (!stack.empty()) {
1518-
auto proto = stack.back();
1519-
stack.pop_back();
1520-
1521-
// Visit this protocol.
1522-
if (fn(proto))
1523-
return true;
1524-
1525-
// Add inherited protocols that we haven't seen already.
1526-
for (auto inherited : proto->getInheritedProtocols()) {
1527-
if (knownProtocols.insert(inherited).second)
1528-
stack.push_back(inherited);
1529-
}
1530-
}
1531-
1532-
return false;
1533-
}
1534-
15351504
static void canonicalizeProtocols(SmallVectorImpl<ProtocolDecl *> &protocols,
15361505
ParameterizedProtocolMap *parameterized) {
15371506
llvm::SmallDenseMap<ProtocolDecl *, unsigned> known;

0 commit comments

Comments
 (0)