Skip to content

Commit 2cbcea9

Browse files
author
Amritpan Kaur
committed
[ConstraintSystem] Print constraints added/removed during simplification.
1 parent 6063ab5 commit 2cbcea9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

include/swift/Sema/ConstraintSystem.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4422,6 +4422,14 @@ class ConstraintSystem {
44224422
// Add this constraint to the constraint graph.
44234423
CG.addConstraint(constraint);
44244424

4425+
if (isDebugMode() && getPhase() == ConstraintSystemPhase::Solving) {
4426+
auto &log = llvm::errs();
4427+
log.indent(solverState->getCurrentIndent() + 2);
4428+
log << "(added constraint: ";
4429+
constraint->print(log, &getASTContext().SourceMgr);
4430+
log << ")\n";
4431+
}
4432+
44254433
// Record this as a newly-generated constraint.
44264434
if (solverState)
44274435
solverState->addGeneratedConstraint(constraint);
@@ -4432,6 +4440,14 @@ class ConstraintSystem {
44324440
CG.removeConstraint(constraint);
44334441
InactiveConstraints.erase(constraint);
44344442

4443+
if (isDebugMode() && getPhase() == ConstraintSystemPhase::Solving) {
4444+
auto &log = llvm::errs();
4445+
log.indent(solverState->getCurrentIndent() + 2);
4446+
log << "(removed constraint: ";
4447+
constraint->print(log, &getASTContext().SourceMgr);
4448+
log << ")\n";
4449+
}
4450+
44354451
if (solverState)
44364452
solverState->retireConstraint(constraint);
44374453
}

0 commit comments

Comments
 (0)