Skip to content

Commit a4320d1

Browse files
author
Amritpan Kaur
committed
[ConstraintSystem] Print added/removed constraints.
1 parent 2efcf25 commit a4320d1

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
@@ -4444,6 +4444,13 @@ class ConstraintSystem {
44444444
// Add this constraint to the constraint graph.
44454445
CG.addConstraint(constraint);
44464446

4447+
if (isDebugMode() && getPhase() == ConstraintSystemPhase::Solving) {
4448+
auto &log = llvm::errs();
4449+
log.indent(solverState->getCurrentIndent() + 2) << "(added constraint: ";
4450+
constraint->print(log, &getASTContext().SourceMgr);
4451+
log << ")\n";
4452+
}
4453+
44474454
// Record this as a newly-generated constraint.
44484455
if (solverState)
44494456
solverState->addGeneratedConstraint(constraint);
@@ -4454,6 +4461,14 @@ class ConstraintSystem {
44544461
CG.removeConstraint(constraint);
44554462
InactiveConstraints.erase(constraint);
44564463

4464+
if (isDebugMode() && getPhase() == ConstraintSystemPhase::Solving) {
4465+
auto &log = llvm::errs();
4466+
log.indent(solverState->getCurrentIndent() + 2)
4467+
<< "(removed constraint: ";
4468+
constraint->print(log, &getASTContext().SourceMgr);
4469+
log << ")\n";
4470+
}
4471+
44574472
if (solverState)
44584473
solverState->retireConstraint(constraint);
44594474
}

0 commit comments

Comments
 (0)