Skip to content

Commit 1bdf7f0

Browse files
committed
Sema: Assert that the constraint graph node is empty before recycling
1 parent 1a18d70 commit 1bdf7f0

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

lib/Sema/ConstraintGraph.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,18 @@ ConstraintGraph::operator[](TypeVariableType *typeVar) {
9898
}
9999

100100
void ConstraintGraphNode::reset() {
101-
ASSERT(TypeVar);
101+
if (CONDITIONAL_ASSERT_enabled()) {
102+
ASSERT(TypeVar);
103+
ASSERT(Constraints.empty());
104+
ASSERT(ConstraintIndex.empty());
105+
ASSERT(ReferencedBy.empty());
106+
ASSERT(References.empty());
107+
ASSERT(EquivalenceClass.size() <= 1);
108+
}
109+
102110
TypeVar = nullptr;
103-
Bindings.reset();
104-
Constraints.clear();
105-
ConstraintIndex.clear();
106-
ReferencedBy.clear();
107-
References.clear();
108111
EquivalenceClass.clear();
112+
Bindings.reset();
109113
}
110114

111115
bool ConstraintGraphNode::forRepresentativeVar() const {

0 commit comments

Comments
 (0)