@@ -300,18 +300,25 @@ class ConstraintGraph {
300
300
// / to a type variable.
301
301
void introduceToInference (TypeVariableType *typeVar, Type fixedType);
302
302
303
- // / Gather constraints associated with all of the variables within the
304
- // / same equivalence class as the given type variable, as well as its
305
- // / immediate fixed bindings.
306
- llvm::TinyPtrVector<Constraint *>
307
- gatherAllConstraints (TypeVariableType *typeVar);
303
+ // / Describes which constraints \c gatherConstraints should gather.
304
+ enum class GatheringKind {
305
+ // / Gather constraints associated with all of the variables within the
306
+ // / same equivalence class as the given type variable, as well as its
307
+ // / immediate fixed bindings.
308
+ EquivalenceClass,
309
+ // / Gather all constraints that mention this type variable or type variables
310
+ // / that it is a fixed binding of. Unlike EquivalenceClass, this looks
311
+ // / through transitive fixed bindings. This can be used to find all the
312
+ // / constraints that may be affected when binding a type variable.
313
+ AllMentions,
314
+ };
308
315
309
- // / Gather all constraints that mention this type variable or type variables
310
- // / that it is a fixed binding of. Unlike EquivalenceClass, this looks
311
- // / through transitive fixed bindings. This can be used to find all the
312
- // / constraints that may be affected when binding a type variable.
316
+ // / Gather the set of constraints that involve the given type variable,
317
+ // / i.e., those constraints that will be affected when the type variable
318
+ // / gets merged or bound to a fixed type.
313
319
llvm::TinyPtrVector<Constraint *>
314
- gatherNearbyConstraints (TypeVariableType *typeVar,
320
+ gatherConstraints (TypeVariableType *typeVar,
321
+ GatheringKind kind,
315
322
llvm::function_ref<bool (Constraint *)> acceptConstraint =
316
323
[](Constraint *constraint) { return true ; });
317
324
@@ -336,6 +343,12 @@ class ConstraintGraph {
336
343
// / The constraints in this component.
337
344
TinyPtrVector<Constraint *> constraints;
338
345
346
+ // / The set of components that this component depends on, such that
347
+ // / the partial solutions of the those components need to be available
348
+ // / before this component can be solved.
349
+ // /
350
+ SmallVector<unsigned , 2 > dependencies;
351
+
339
352
public:
340
353
Component (unsigned solutionIndex) : solutionIndex(solutionIndex) { }
341
354
@@ -351,6 +364,11 @@ class ConstraintGraph {
351
364
return constraints;
352
365
}
353
366
367
+ // / Records a component which this component depends on.
368
+ void recordDependency (const Component &component);
369
+
370
+ ArrayRef<unsigned > getDependencies () const { return dependencies; }
371
+
354
372
unsigned getNumDisjunctions () const { return numDisjunctions; }
355
373
};
356
374
0 commit comments