File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -223,6 +223,9 @@ struct PotentialBindings {
223
223
224
224
TypeVariableType *TypeVar;
225
225
226
+ // / The set of all constraints that have been added via infer().
227
+ llvm::SmallPtrSet<Constraint *, 2 > Constraints;
228
+
226
229
// / The set of potential bindings.
227
230
llvm::SmallVector<PotentialBinding, 4 > Bindings;
228
231
Original file line number Diff line number Diff line change @@ -1769,6 +1769,9 @@ PotentialBindings::inferFromRelational(Constraint *constraint) {
1769
1769
// / representative type variable, along with flags indicating whether
1770
1770
// / those types should be opened.
1771
1771
void PotentialBindings::infer (Constraint *constraint) {
1772
+ if (!Constraints.insert (constraint).second )
1773
+ return ;
1774
+
1772
1775
switch (constraint->getKind ()) {
1773
1776
case ConstraintKind::Bind:
1774
1777
case ConstraintKind::Equal:
@@ -1937,6 +1940,9 @@ void PotentialBindings::infer(Constraint *constraint) {
1937
1940
}
1938
1941
1939
1942
void PotentialBindings::retract (Constraint *constraint) {
1943
+ if (!Constraints.erase (constraint))
1944
+ return ;
1945
+
1940
1946
Bindings.erase (
1941
1947
llvm::remove_if (Bindings,
1942
1948
[&constraint](const PotentialBinding &binding) {
You can’t perform that action at this time.
0 commit comments