Skip to content

Commit 87577d2

Browse files
committed
[CS] NFC: Make failedConstraint private
1 parent 4b7ed3e commit 87577d2

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

lib/Sema/CSStep.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ StepResult DependentComponentSplitterStep::take(bool prevFailed) {
260260
// "split" is considered a failure if previous step failed,
261261
// or there is a failure recorded by constraint system, or
262262
// system can't be simplified.
263-
if (prevFailed || CS.failedConstraint || CS.simplify())
263+
if (prevFailed || CS.getFailedConstraint() || CS.simplify())
264264
return done(/*isSuccess=*/false);
265265

266266
// Figure out the sets of partial solutions that this component depends on.

lib/Sema/ConstraintSystem.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,8 +1613,6 @@ class ConstraintSystem {
16131613

16141614
class SolverScope;
16151615

1616-
Constraint *failedConstraint = nullptr;
1617-
16181616
/// Expressions that are known to be unevaluated.
16191617
/// Note: this is only used to support ObjCSelectorExpr at the moment.
16201618
llvm::SmallPtrSet<Expr *, 2> UnevaluatedRootExprs;
@@ -1623,6 +1621,10 @@ class ConstraintSystem {
16231621
unsigned CountDisjunctions = 0;
16241622

16251623
private:
1624+
/// A constraint that has failed along the current solver path.
1625+
/// Do not set directly, call \c recordFailedConstraint instead.
1626+
Constraint *failedConstraint = nullptr;
1627+
16261628
/// Current phase of the constraint system lifetime.
16271629
ConstraintSystemPhase Phase = ConstraintSystemPhase::ConstraintGeneration;
16281630

@@ -2098,6 +2100,10 @@ class ConstraintSystem {
20982100
};
20992101

21002102
public:
2103+
/// Retrieve the first constraint that has failed along the solver's path, or
2104+
/// \c nullptr if no constraint has failed.
2105+
Constraint *getFailedConstraint() const { return failedConstraint; }
2106+
21012107
ConstraintSystemPhase getPhase() const { return Phase; }
21022108

21032109
/// Move constraint system to a new phase of its lifetime.

0 commit comments

Comments
 (0)