Skip to content

Commit 319bc07

Browse files
committed
GSB: Use compareRequirements() in enumerateRequirements()
1 parent 00fd10e commit 319bc07

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8183,25 +8183,16 @@ void GenericSignatureBuilder::enumerateRequirements(
81838183
}
81848184
}
81858185

8186-
// Sort the protocols in canonical order.
8187-
llvm::array_pod_sort(protocols.begin(), protocols.end(),
8188-
TypeDecl::compare);
8189-
81908186
// Enumerate the conformance requirements.
81918187
for (auto proto : protocols) {
81928188
recordRequirement(RequirementKind::Conformance, subjectType, proto);
81938189
}
81948190
}
81958191
}
81968192

8197-
// Sort the subject types in canonical order. This needs to be a stable sort
8198-
// so that the relative order of requirements that have the same subject type
8199-
// is preserved.
8200-
std::stable_sort(requirements.begin(), requirements.end(),
8201-
[](const Requirement &lhs, const Requirement &rhs) {
8202-
return compareDependentTypes(lhs.getFirstType(),
8203-
rhs.getFirstType()) < 0;
8204-
});
8193+
// Sort the requirements in canonical order.
8194+
llvm::array_pod_sort(requirements.begin(), requirements.end(),
8195+
compareRequirements);
82058196
}
82068197

82078198
void GenericSignatureBuilder::dump() {

0 commit comments

Comments
 (0)