Skip to content

Commit 13cc1ad

Browse files
committed
AST: Remove SubstitutionMap::getConformances()
1 parent b41888a commit 13cc1ad

File tree

3 files changed

+16
-19
lines changed

3 files changed

+16
-19
lines changed

include/swift/AST/SubstitutionMap.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@ class SubstitutionMap {
8080
CanType type, ProtocolDecl *proto,
8181
llvm::SmallPtrSetImpl<CanType> *visitedParents = nullptr) const;
8282

83-
/// Retrieve the conformances for the given type.
84-
ArrayRef<ProtocolConformanceRef> getConformances(CanType type) const;
85-
8683
bool empty() const {
8784
return subMap.empty();
8885
}

lib/AST/SubstitutionMap.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,6 @@ addConformance(CanType type, ProtocolConformanceRef conformance) {
209209
conformanceMap[type.getPointer()].push_back(conformance);
210210
}
211211

212-
ArrayRef<ProtocolConformanceRef> SubstitutionMap::
213-
getConformances(CanType type) const {
214-
auto known = conformanceMap.find(type.getPointer());
215-
if (known == conformanceMap.end()) return { };
216-
return known->second;
217-
}
218-
219212
void SubstitutionMap::
220213
addParent(CanType type, CanType parent, AssociatedTypeDecl *assocType) {
221214
assert(type && parent && assocType);

lib/SIL/Mangle.cpp

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,22 @@ void GenericSpecializationMangler::mangleSpecialization() {
5151
SILFunctionType *FTy = Function->getLoweredFunctionType();
5252
CanGenericSignature Sig = FTy->getGenericSignature();
5353
auto SubMap = Sig->getSubstitutionMap(Subs);
54-
for (Type DepType : Sig->getSubstitutableParams()) {
55-
M.mangleType(DepType.subst(SubMap)->getCanonicalType(), 0);
56-
for (auto C : SubMap.getConformances(DepType->getCanonicalType())) {
57-
if (C.isAbstract())
58-
return;
59-
M.mangleProtocolConformance(C.getConcrete());
60-
}
61-
M.append('_');
62-
}
54+
Sig->enumeratePairedRequirements(
55+
[&](Type depTy, ArrayRef<Requirement> reqts) {
56+
if (depTy->is<GenericTypeParamType>())
57+
M.mangleType(depTy.subst(SubMap)->getCanonicalType(), 0);
58+
59+
for (auto reqt : reqts) {
60+
auto conformance = SubMap.lookupConformance(
61+
depTy->getCanonicalType(),
62+
reqt.getSecondType()->castTo<ProtocolType>()->getDecl());
63+
if (conformance && conformance->isConcrete())
64+
M.mangleProtocolConformance(conformance->getConcrete());
65+
}
66+
M.append('_');
67+
68+
return false;
69+
});
6370
}
6471

6572
void PartialSpecializationMangler::mangleSpecialization() {

0 commit comments

Comments
 (0)