Sema: Avoid copying BindingSets

They're stored inside the ConstraintGraphNode now, so returning a
`const BindingSet *` from within determineBestBindings() should
be safe.
This commit is contained in:
Slava Pestov
2025-12-10 17:19:54 -05:00
parent da8b721654
commit ba7df4013e
9 changed files with 22 additions and 21 deletions

View File

@@ -385,6 +385,10 @@ public:
BindingSet(ConstraintSystem &CS, TypeVariableType *TypeVar,
const PotentialBindings &info);
BindingSet(BindingSet &&other) = default;
BindingSet(const BindingSet &other) = delete;
ConstraintSystem &getConstraintSystem() const { return CS; }
TypeVariableType *getTypeVariable() const { return TypeVar; }

View File

@@ -5270,7 +5270,7 @@ public:
/// Determine whether given type variable with its set of bindings is viable
/// to be attempted on the next step of the solver.
std::optional<BindingSet> determineBestBindings(
const BindingSet *determineBestBindings(
llvm::function_ref<void(const BindingSet &)> onCandidate);
/// Get bindings for the given type variable based on current
@@ -6200,7 +6200,7 @@ class TypeVarBindingProducer : public BindingProducer<TypeVariableBinding> {
public:
using Element = TypeVariableBinding;
TypeVarBindingProducer(BindingSet &bindings);
TypeVarBindingProducer(const BindingSet &bindings);
/// Retrieve a set of bindings available in the current state.
ArrayRef<Binding> getCurrentBindings() const { return Bindings; }