Skip to content

Commit 58b14ff

Browse files
committed
Update -debug-constraints to dump the source range immediately.
We end up dumping information during constraint generation, and it's nice to know which range we're dealing with at that point.
1 parent cb8bbf0 commit 58b14ff

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/Sema/CSSolver.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1897,6 +1897,18 @@ ConstraintSystem::solve(Expr *&expr,
18971897
ExprTypeCheckListener *listener,
18981898
SmallVectorImpl<Solution> &solutions,
18991899
FreeTypeVariableBinding allowFreeTypeVariables) {
1900+
if (TC.getLangOpts().DebugConstraintSolver) {
1901+
auto &log = getASTContext().TypeCheckerDebug->getStream();
1902+
log << "---Constraint solving for the expression at ";
1903+
auto R = expr->getSourceRange();
1904+
if (R.isValid()) {
1905+
R.print(log, TC.Context.SourceMgr, /*PrintText=*/ false);
1906+
} else {
1907+
log << "<invalid range>";
1908+
}
1909+
log << "---\n";
1910+
}
1911+
19001912
assert(!solverState && "use solveRec for recursive calls");
19011913

19021914
// Try to shrink the system by reducing disjunction domains. This

0 commit comments

Comments
 (0)