Skip to content

Commit 861aa04

Browse files
author
Amritpan Kaur
committed
[CSBindings] Consolidate BindingSet dump into single function.
1 parent 982c5bb commit 861aa04

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

include/swift/Sema/CSBindings.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,8 +546,6 @@ class BindingSet {
546546
}
547547

548548
void dump(llvm::raw_ostream &out, unsigned indent) const;
549-
void dump(TypeVariableType *typeVar, llvm::raw_ostream &out,
550-
unsigned indent = 0) const LLVM_ATTRIBUTE_USED;
551549

552550
private:
553551
void addBinding(PotentialBinding binding);

lib/Sema/CSBindings.cpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ Optional<BindingSet> ConstraintSystem::determineBestBindings() {
808808
continue;
809809

810810
if (isDebugMode()) {
811-
bindings.dump(typeVar, llvm::errs(), solverState->getCurrentIndent());
811+
bindings.dump(llvm::errs(), solverState->getCurrentIndent());
812812
}
813813

814814
// If these are the first bindings, or they are better than what
@@ -1655,21 +1655,15 @@ static std::string getCollectionLiteralAsString(KnownProtocolKind KPK) {
16551655
#undef ENTRY
16561656
}
16571657

1658-
void BindingSet::dump(TypeVariableType *typeVar, llvm::raw_ostream &out,
1659-
unsigned indent) const {
1660-
out.indent(indent);
1661-
out << "(";
1662-
if (typeVar)
1663-
out << "$T" << typeVar->getImpl().getID();
1664-
dump(out, 1);
1665-
out << ")\n";
1666-
}
1667-
16681658
void BindingSet::dump(llvm::raw_ostream &out, unsigned indent) const {
16691659
PrintOptions PO;
16701660
PO.PrintTypesForDebugging = true;
16711661

16721662
out.indent(indent);
1663+
out << "(";
1664+
if (auto typeVar = getTypeVariable())
1665+
out << "$T" << typeVar->getImpl().getID() << " ";
1666+
16731667
std::vector<std::string> attributes;
16741668
if (isDirectHole())
16751669
attributes.push_back("hole");
@@ -1769,6 +1763,7 @@ void BindingSet::dump(llvm::raw_ostream &out, unsigned indent) const {
17691763
}
17701764
out << "] ";
17711765
}
1766+
out << ")\n";
17721767
}
17731768

17741769
// Given a possibly-Optional type, return the direct superclass of the

0 commit comments

Comments
 (0)