@@ -791,22 +791,29 @@ void ConstraintGraphNode::dump() {
791
791
print (llvm::dbgs (), 0 );
792
792
}
793
793
794
- void ConstraintGraph::print (llvm::raw_ostream &out) {
795
- for (auto typeVar : TypeVariables) {
794
+ void ConstraintGraph::print (ArrayRef<TypeVariableType *> typeVars,
795
+ llvm::raw_ostream &out) {
796
+ for (auto typeVar : typeVars) {
796
797
(*this )[typeVar].print (out, 2 );
797
798
out << " \n " ;
798
799
}
799
800
}
800
801
801
802
void ConstraintGraph::dump () {
803
+ dump (llvm::dbgs ());
804
+ }
805
+
806
+ void ConstraintGraph::dump (llvm::raw_ostream &out) {
802
807
llvm::SaveAndRestore<bool >
803
808
debug (CS.getASTContext ().LangOpts .DebugConstraintSolver , true );
804
- print (llvm::dbgs () );
809
+ print (CS. TypeVariables , out );
805
810
}
806
811
807
- void ConstraintGraph::printConnectedComponents (llvm::raw_ostream &out) {
812
+ void ConstraintGraph::printConnectedComponents (
813
+ ArrayRef<TypeVariableType *> inTypeVars,
814
+ llvm::raw_ostream &out) {
808
815
std::vector<TypeVariableType *> typeVars;
809
- typeVars.insert (typeVars.end (), TypeVariables .begin (), TypeVariables .end ());
816
+ typeVars.insert (typeVars.end (), inTypeVars .begin (), inTypeVars .end ());
810
817
std::vector<unsigned > components;
811
818
unsigned numComponents = computeConnectedComponents (typeVars, components);
812
819
for (unsigned component = 0 ; component != numComponents; ++component) {
@@ -823,7 +830,7 @@ void ConstraintGraph::printConnectedComponents(llvm::raw_ostream &out) {
823
830
}
824
831
825
832
void ConstraintGraph::dumpConnectedComponents () {
826
- printConnectedComponents (llvm::dbgs ());
833
+ printConnectedComponents (CS. TypeVariables , llvm::dbgs ());
827
834
}
828
835
829
836
#pragma mark Verification of graph invariants
@@ -856,7 +863,7 @@ static void _require(bool condition, const Twine &complaint,
856
863
857
864
// Print the graph.
858
865
// FIXME: Highlight the offending node/constraint/etc.
859
- cg.print (llvm::dbgs ());
866
+ cg.dump (llvm::dbgs ());
860
867
861
868
abort ();
862
869
}
0 commit comments