Skip to content

[ConstraintSystem] Remove Component, which is no longer used. #19441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 21, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 0 additions & 52 deletions lib/Sema/ConstraintSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -3534,58 +3534,6 @@ class DisjunctionChoiceProducer : public BindingProducer<DisjunctionChoice> {
IsExplicitConversion);
}
};

/// \brief Constraint System "component" represents
/// a single solvable unit, but the process of assigning
/// types in some cases allows it to be further split into
/// multiple smaller parts.
///
/// This helps to abstract away logic of holding and
/// returning sub-set of the constraints in the system,
/// as well as its partial solving and result tracking.
class Component {
ConstraintList Constraints;
SmallVector<Constraint *, 8> Disjunctions;

public:
void reinstateTo(ConstraintList &workList) {
workList.splice(workList.end(), Constraints);
}

void record(Constraint *constraint) {
Constraints.push_back(constraint);
if (constraint->getKind() == ConstraintKind::Disjunction)
Disjunctions.push_back(constraint);
}

bool solve(ConstraintSystem &cs, SmallVectorImpl<Solution> &solutions) {
// Return constraints from the bucket back into circulation.
reinstateTo(cs.InactiveConstraints);

// Solve for this component. If it fails, we're done.
bool failed;

{
// Introduce a scope for this partial solution.
ConstraintSystem::SolverScope scope(cs);
llvm::SaveAndRestore<ConstraintSystem::SolverScope *>
partialSolutionScope(cs.solverState->PartialSolutionScope, &scope);

failed = cs.solveSimplified(solutions);
}

// Put the constraints back into their original bucket.
Constraints.splice(Constraints.end(), cs.InactiveConstraints);
return failed;
}

bool operator<(const Component &other) const {
return disjunctionCount() < other.disjunctionCount();
}

private:
unsigned disjunctionCount() const { return Disjunctions.size(); }
};
} // end namespace constraints

template<typename ...Args>
Expand Down