[Constraint graph] Move constraint uniquing into gatherConstraints().

Simplify the interface to gatherConstraints() by performing the
uniquing within the function itself and returning only the resulting
(uniqued) vector of constraints.
This commit is contained in:
Doug Gregor
2019-07-25 02:13:27 -04:00
parent dfdd352d3d
commit 8355f3d270
8 changed files with 65 additions and 67 deletions

View File

@@ -7133,9 +7133,8 @@ ConstraintSystem::addKeyPathApplicationRootConstraint(Type root, ConstraintLocat
if (!typeVar)
return;
llvm::SetVector<Constraint *> constraints;
CG.gatherConstraints(
typeVar, constraints, ConstraintGraph::GatheringKind::EquivalenceClass,
auto constraints = CG.gatherConstraints(
typeVar, ConstraintGraph::GatheringKind::EquivalenceClass,
[&keyPathExpr](Constraint *constraint) -> bool {
return constraint->getKind() == ConstraintKind::KeyPath &&
constraint->getLocator()->getAnchor() == keyPathExpr;