Skip to content

Commit d9aba53

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

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
@@ -4422,6 +4422,13 @@ 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) << "(added constraint: ";
4428+
constraint->print(log, &getASTContext().SourceMgr);
4429+
log << ")\n";
4430+
}
4431+
44254432
// Record this as a newly-generated constraint.
44264433
if (solverState)
44274434
solverState->addGeneratedConstraint(constraint);
@@ -4432,6 +4439,14 @@ class ConstraintSystem {
44324439
CG.removeConstraint(constraint);
44334440
InactiveConstraints.erase(constraint);
44344441

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

0 commit comments

Comments
 (0)