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 {
245
245
ConstraintSystem &getConstraintSystem () const { return CS; }
246
246
247
247
// / 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);
255
249
256
250
// / Add a new constraint to the graph.
257
251
void addConstraint (Constraint *constraint);
Original file line number Diff line number Diff line change @@ -50,8 +50,8 @@ ConstraintGraph::~ConstraintGraph() {
50
50
51
51
#pragma mark Graph accessors
52
52
53
- std::pair< ConstraintGraphNode &, unsigned >
54
- ConstraintGraph::lookupNode (TypeVariableType *typeVar) {
53
+ ConstraintGraphNode &
54
+ ConstraintGraph::operator [] (TypeVariableType *typeVar) {
55
55
// Check whether we've already created a node for this type variable.
56
56
auto &impl = typeVar->getImpl ();
57
57
if (auto nodePtr = impl.getGraphNode ()) {
@@ -60,7 +60,7 @@ ConstraintGraph::lookupNode(TypeVariableType *typeVar) {
60
60
" Type variable mismatch" );
61
61
ASSERT (nodePtr->TypeVar == typeVar &&
62
62
" Use-after-free" );
63
- return { *nodePtr, impl. getGraphIndex () } ;
63
+ return *nodePtr;
64
64
}
65
65
66
66
// Allocate the new node.
@@ -98,7 +98,7 @@ ConstraintGraph::lookupNode(TypeVariableType *typeVar) {
98
98
bindTypeVariable (typeVar, fixed);
99
99
}
100
100
101
- return { *nodePtr, index } ;
101
+ return *nodePtr;
102
102
}
103
103
104
104
void ConstraintGraphNode::reset () {
Original file line number Diff line number Diff line change @@ -1103,8 +1103,8 @@ TypeVariableType *ConstraintSystem::isRepresentativeFor(
1103
1103
return nullptr ;
1104
1104
1105
1105
auto &CG = getConstraintGraph ();
1106
- auto result = CG. lookupNode ( typeVar) ;
1107
- auto equivalence = result.first . getEquivalenceClass ();
1106
+ auto & result = CG[ typeVar] ;
1107
+ auto equivalence = result.getEquivalenceClass ();
1108
1108
auto member = llvm::find_if (equivalence, [=](TypeVariableType *eq) {
1109
1109
auto *loc = eq->getImpl ().getLocator ();
1110
1110
if (!loc)
You can’t perform that action at this time.
0 commit comments