Skip to content

Commit

Permalink
[CSSolver] add debug logging to solveForCodeCompletion
Browse files Browse the repository at this point in the history
  • Loading branch information
xedin authored and nathawes committed Aug 29, 2020
1 parent a49404d commit 5bd19d2
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/Sema/CSSolver.cpp
Expand Up @@ -1432,6 +1432,14 @@ void ConstraintSystem::solveForCodeCompletion(
if (!cs.generateConstraints(expr, DC))
return;

if (cs.isDebugMode()) {
auto &log = llvm::errs();
log << "--- Code Completion ---\n";
cs.print(log, expr);
log << '\n';
cs.print(log);
}

llvm::SmallVector<Solution, 4> solutions;

{
Expand All @@ -1445,7 +1453,17 @@ void ConstraintSystem::solveForCodeCompletion(
cs.solveImpl(solutions);
}

if (cs.isDebugMode()) {
llvm::errs() << "--- Discovered " << solutions.size() << " solutions ---\n";
}

for (const auto &solution : solutions) {
if (cs.isDebugMode()) {
auto &log = llvm::errs();
log << "--- Solution ---\n";
solution.dump(log);
}

callback(solution);
}
}
Expand Down

0 comments on commit 5bd19d2

Please sign in to comment.