Improve indentation in debugging output

This commit is contained in:
Timofey Solonin
2022-11-17 23:06:13 +08:00
parent 3c401a1c7e
commit 3f366947e4
11 changed files with 167 additions and 128 deletions

View File

@@ -360,7 +360,8 @@ Constraint *Constraint::clone(ConstraintSystem &cs) const {
llvm_unreachable("Unhandled ConstraintKind in switch.");
}
void Constraint::print(llvm::raw_ostream &Out, SourceManager *sm, unsigned indent, bool skipLocator) const {
void Constraint::print(llvm::raw_ostream &Out, SourceManager *sm,
unsigned indent, bool skipLocator) const {
// Print all type variables as $T0 instead of _ here.
PrintOptions PO;
PO.PrintTypesForDebugging = true;
@@ -395,19 +396,21 @@ void Constraint::print(llvm::raw_ostream &Out, SourceManager *sm, unsigned inden
return false;
});
interleave(sortedConstraints,
[&](Constraint *constraint) {
Out.indent(indent);
if (constraint->isDisabled())
Out << "> [disabled] ";
else if (constraint->isFavored())
Out << "> [favored] ";
else
Out << "> ";
constraint->print(Out, sm, indent,
/*skipLocator=*/constraint->getLocator() == Locator);
},
[&] { Out << "\n"; });
interleave(
sortedConstraints,
[&](Constraint *constraint) {
Out.indent(indent + 2);
if (constraint->isDisabled())
Out << "> [disabled] ";
else if (constraint->isFavored())
Out << "> [favored] ";
else
Out << "> ";
constraint->print(Out, sm, indent,
/*skipLocator=*/constraint->getLocator() ==
Locator);
},
[&] { Out << "\n"; });
return;
}