Skip to content

Commit d750d38

Browse files
author
Amritpan Kaur
committed
[CSBindings] Consolidate BindingSet dump into single function.
1 parent 01ea11b commit d750d38

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
@@ -805,7 +805,7 @@ Optional<BindingSet> ConstraintSystem::determineBestBindings() {
805805
continue;
806806

807807
if (isDebugMode()) {
808-
bindings.dump(typeVar, llvm::errs(), solverState->getCurrentIndent());
808+
bindings.dump(llvm::errs(), solverState->getCurrentIndent());
809809
}
810810

811811
// If these are the first bindings, or they are better than what
@@ -1652,21 +1652,15 @@ static std::string getCollectionLiteralAsString(KnownProtocolKind KPK) {
16521652
#undef ENTRY
16531653
}
16541654

1655-
void BindingSet::dump(TypeVariableType *typeVar, llvm::raw_ostream &out,
1656-
unsigned indent) const {
1657-
out.indent(indent);
1658-
out << "(";
1659-
if (typeVar)
1660-
out << "$T" << typeVar->getImpl().getID();
1661-
dump(out, 1);
1662-
out << ")\n";
1663-
}
1664-
16651655
void BindingSet::dump(llvm::raw_ostream &out, unsigned indent) const {
16661656
PrintOptions PO;
16671657
PO.PrintTypesForDebugging = true;
16681658

16691659
out.indent(indent);
1660+
out << "(";
1661+
if (auto typeVar = getTypeVariable())
1662+
out << "$T" << typeVar->getImpl().getID() << " ";
1663+
16701664
std::vector<std::string> attributes;
16711665
if (isDirectHole())
16721666
attributes.push_back("hole");
@@ -1778,6 +1772,7 @@ void BindingSet::dump(llvm::raw_ostream &out, unsigned indent) const {
17781772
}
17791773
out << "] ";
17801774
}
1775+
out << ")\n";
17811776
}
17821777

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

0 commit comments

Comments
 (0)