Skip to content

Commit 0b85ce6

Browse files
committed
Sema: Remove SolverScope::numFixes
1 parent bdab82a commit 0b85ce6

File tree

4 files changed

+8
-17
lines changed

4 files changed

+8
-17
lines changed

include/swift/Sema/ConstraintSystem.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2533,8 +2533,8 @@ class ConstraintSystem {
25332533
/// The number of the solution attempts we're looking at.
25342534
unsigned SolutionAttempt;
25352535

2536-
/// Refers to the innermost partial solution scope.
2537-
SolverScope *PartialSolutionScope = nullptr;
2536+
/// The number of fixes in the innermost partial solution scope.
2537+
unsigned numPartialSolutionFixes = 0;
25382538

25392539
// Statistics
25402540
#define CS_STATISTIC(Name, Description) unsigned Name = 0;
@@ -2784,11 +2784,6 @@ class ConstraintSystem {
27842784
/// The length of \c Trail.
27852785
unsigned numTrailChanges;
27862786

2787-
/// The length of \c Fixes.
2788-
///
2789-
/// FIXME: Remove this.
2790-
unsigned numFixes;
2791-
27922787
/// The scope number of this scope. Set when the scope is registered.
27932788
unsigned scopeNumber = 0;
27942789

lib/Sema/CSSolver.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,8 @@ Solution ConstraintSystem::finalize() {
128128

129129
// For each of the fixes, record it as an operation on the affected
130130
// expression.
131-
unsigned firstFixIndex = 0;
132-
if (solverState && solverState->PartialSolutionScope) {
133-
firstFixIndex = solverState->PartialSolutionScope->numFixes;
134-
}
135-
131+
unsigned firstFixIndex =
132+
(solverState ? solverState->numPartialSolutionFixes : 0);
136133
for (const auto &fix :
137134
llvm::make_range(Fixes.begin() + firstFixIndex, Fixes.end()))
138135
solution.Fixes.push_back(fix);
@@ -709,7 +706,6 @@ ConstraintSystem::SolverScope::SolverScope(ConstraintSystem &cs)
709706
numTrailChanges = cs.solverState->Trail.size();
710707

711708
numTypeVariables = cs.TypeVariables.size();
712-
numFixes = cs.Fixes.size();
713709

714710
cs.solverState->beginScope(this);
715711
assert(!cs.failedConstraint && "Unexpected failed constraint!");

lib/Sema/CSStep.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ ComponentStep::Scope::Scope(ComponentStep &component)
4242
workList.splice(workList.end(), *component.Constraints);
4343

4444
SolverScope = new ConstraintSystem::SolverScope(CS);
45-
PrevPartialScope = CS.solverState->PartialSolutionScope;
46-
CS.solverState->PartialSolutionScope = SolverScope;
45+
prevPartialSolutionFixes = CS.solverState->numPartialSolutionFixes;
46+
CS.solverState->numPartialSolutionFixes = CS.Fixes.size();
4747
}
4848

4949
StepResult SplitterStep::take(bool prevFailed) {

lib/Sema/CSStep.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ class ComponentStep final : public SolverStep {
342342
ConstraintSystem::SolverScope *SolverScope;
343343

344344
SetVector<TypeVariableType *> TypeVars;
345-
ConstraintSystem::SolverScope *PrevPartialScope = nullptr;
345+
unsigned prevPartialSolutionFixes = 0;
346346

347347
// The component this scope is associated with.
348348
ComponentStep &Component;
@@ -352,7 +352,7 @@ class ComponentStep final : public SolverStep {
352352

353353
~Scope() {
354354
delete SolverScope; // rewind back all of the changes.
355-
CS.solverState->PartialSolutionScope = PrevPartialScope;
355+
CS.solverState->numPartialSolutionFixes = prevPartialSolutionFixes;
356356

357357
// return all of the saved type variables back to the system.
358358
CS.TypeVariables = std::move(TypeVars);

0 commit comments

Comments
 (0)