Skip to content

Commit c0dbec0

Browse files
authored
Merge pull request swiftlang#12276 from xedin/add-failed-constriant-logging
[ConstraintSolver] Add debug logging of failed constraints while solving
2 parents 41aa442 + 03a3933 commit c0dbec0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/Sema/CSSolver.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,14 @@ bool ConstraintSystem::simplify(bool ContinueAfterFailures) {
352352
failedConstraint = constraint;
353353
}
354354

355+
if (TC.getLangOpts().DebugConstraintSolver) {
356+
auto &log = getASTContext().TypeCheckerDebug->getStream();
357+
log.indent(solverState ? solverState->depth * 2 : 0)
358+
<< "(failed constraint ";
359+
constraint->print(log, &getASTContext().SourceMgr);
360+
log << ")\n";
361+
}
362+
355363
if (solverState)
356364
solverState->retireConstraint(constraint);
357365

0 commit comments

Comments
 (0)