File tree Expand file tree Collapse file tree 3 files changed +7
-13
lines changed
Expand file tree Collapse file tree 3 files changed +7
-13
lines changed Original file line number Diff line number Diff line change @@ -245,13 +245,7 @@ class ConstraintGraph {
245245 ConstraintSystem &getConstraintSystem () const { return CS; }
246246
247247 // / Access the node corresponding to the given type variable.
248- ConstraintGraphNode &operator [](TypeVariableType *typeVar) {
249- return lookupNode (typeVar).first ;
250- }
251-
252- // / Retrieve the node and index corresponding to the given type variable.
253- std::pair<ConstraintGraphNode &, unsigned >
254- lookupNode (TypeVariableType *typeVar);
248+ ConstraintGraphNode &operator [](TypeVariableType *typeVar);
255249
256250 // / Add a new constraint to the graph.
257251 void addConstraint (Constraint *constraint);
Original file line number Diff line number Diff line change @@ -50,8 +50,8 @@ ConstraintGraph::~ConstraintGraph() {
5050
5151#pragma mark Graph accessors
5252
53- std::pair< ConstraintGraphNode &, unsigned >
54- ConstraintGraph::lookupNode (TypeVariableType *typeVar) {
53+ ConstraintGraphNode &
54+ ConstraintGraph::operator [] (TypeVariableType *typeVar) {
5555 // Check whether we've already created a node for this type variable.
5656 auto &impl = typeVar->getImpl ();
5757 if (auto nodePtr = impl.getGraphNode ()) {
@@ -60,7 +60,7 @@ ConstraintGraph::lookupNode(TypeVariableType *typeVar) {
6060 " Type variable mismatch" );
6161 ASSERT (nodePtr->TypeVar == typeVar &&
6262 " Use-after-free" );
63- return { *nodePtr, impl. getGraphIndex () } ;
63+ return *nodePtr;
6464 }
6565
6666 // Allocate the new node.
@@ -98,7 +98,7 @@ ConstraintGraph::lookupNode(TypeVariableType *typeVar) {
9898 bindTypeVariable (typeVar, fixed);
9999 }
100100
101- return { *nodePtr, index } ;
101+ return *nodePtr;
102102}
103103
104104void ConstraintGraphNode::reset () {
Original file line number Diff line number Diff line change @@ -1099,8 +1099,8 @@ TypeVariableType *ConstraintSystem::isRepresentativeFor(
10991099 return nullptr ;
11001100
11011101 auto &CG = getConstraintGraph ();
1102- auto result = CG. lookupNode ( typeVar) ;
1103- auto equivalence = result.first . getEquivalenceClass ();
1102+ auto & result = CG[ typeVar] ;
1103+ auto equivalence = result.getEquivalenceClass ();
11041104 auto member = llvm::find_if (equivalence, [=](TypeVariableType *eq) {
11051105 auto *loc = eq->getImpl ().getLocator ();
11061106 if (!loc)
You can’t perform that action at this time.
0 commit comments