Skip to content

Commit 7576562

Browse files
author
Amritpan Kaur
committed
[ConstraintSystem] Print constraints added/removed.
1 parent 10881c1 commit 7576562

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

include/swift/Sema/ConstraintSystem.h

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

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

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

0 commit comments

Comments
 (0)