@@ -36,61 +36,60 @@ void ConstraintSystem::increaseScore(ScoreKind kind, unsigned value) {
3636 CurrentScore.Data [index] += value;
3737
3838 if (isDebugMode () && value > 0 ) {
39- auto &log = getASTContext ().TypeCheckerDebug ->getStream ();
4039 if (solverState)
41- log .indent (solverState->depth * 2 );
42- log << " (increasing score due to " ;
40+ llvm::errs () .indent (solverState->depth * 2 );
41+ llvm::errs () << " (increasing score due to " ;
4342 switch (kind) {
4443 case SK_Hole:
45- log << " hole in the constraint system" ;
44+ llvm::errs () << " hole in the constraint system" ;
4645 break ;
4746
4847 case SK_Unavailable:
49- log << " use of an unavailable declaration" ;
48+ llvm::errs () << " use of an unavailable declaration" ;
5049 break ;
5150
5251 case SK_Fix:
53- log << " attempting to fix the source" ;
52+ llvm::errs () << " attempting to fix the source" ;
5453 break ;
5554
5655 case SK_DisfavoredOverload:
57- log << " disfavored overload" ;
56+ llvm::errs () << " disfavored overload" ;
5857 break ;
5958
6059 case SK_ForceUnchecked:
61- log << " force of an implicitly unwrapped optional" ;
60+ llvm::errs () << " force of an implicitly unwrapped optional" ;
6261 break ;
6362
6463 case SK_UserConversion:
65- log << " user conversion" ;
64+ llvm::errs () << " user conversion" ;
6665 break ;
6766
6867 case SK_FunctionConversion:
69- log << " function conversion" ;
68+ llvm::errs () << " function conversion" ;
7069 break ;
7170
7271 case SK_NonDefaultLiteral:
73- log << " non-default literal" ;
72+ llvm::errs () << " non-default literal" ;
7473 break ;
7574
7675 case SK_CollectionUpcastConversion:
77- log << " collection upcast conversion" ;
76+ llvm::errs () << " collection upcast conversion" ;
7877 break ;
7978
8079 case SK_ValueToOptional:
81- log << " value to optional" ;
80+ llvm::errs () << " value to optional" ;
8281 break ;
8382 case SK_EmptyExistentialConversion:
84- log << " empty-existential conversion" ;
83+ llvm::errs () << " empty-existential conversion" ;
8584 break ;
8685 case SK_KeyPathSubscript:
87- log << " key path subscript" ;
86+ llvm::errs () << " key path subscript" ;
8887 break ;
8988 case SK_ValueToPointerConversion:
90- log << " value-to-pointer conversion" ;
89+ llvm::errs () << " value-to-pointer conversion" ;
9190 break ;
9291 }
93- log << " )\n " ;
92+ llvm::errs () << " )\n " ;
9493 }
9594}
9695
@@ -103,8 +102,7 @@ bool ConstraintSystem::worseThanBestSolution() const {
103102 return false ;
104103
105104 if (isDebugMode ()) {
106- auto &log = getASTContext ().TypeCheckerDebug ->getStream ();
107- log.indent (solverState->depth * 2 )
105+ llvm::errs ().indent (solverState->depth * 2 )
108106 << " (solution is worse than the best solution)\n " ;
109107 }
110108
@@ -389,21 +387,20 @@ bool CompareDeclSpecializationRequest::evaluate(
389387 // Construct a constraint system to compare the two declarations.
390388 ConstraintSystem cs (dc, ConstraintSystemOptions ());
391389 if (cs.isDebugMode ()) {
392- auto &log = C.TypeCheckerDebug ->getStream ();
393- log << " Comparing declarations\n " ;
394- decl1->print (log);
395- log << " \n and\n " ;
396- decl2->print (log);
397- log << " \n (isDynamicOverloadComparison: " ;
398- log << isDynamicOverloadComparison;
399- log << " )\n " ;
390+ llvm::errs () << " Comparing declarations\n " ;
391+ decl1->print (llvm::errs ());
392+ llvm::errs () << " \n and\n " ;
393+ decl2->print (llvm::errs ());
394+ llvm::errs () << " \n (isDynamicOverloadComparison: " ;
395+ llvm::errs () << isDynamicOverloadComparison;
396+ llvm::errs () << " )\n " ;
400397 }
401398
402- auto completeResult = [&C, & cs](bool result) {
399+ auto completeResult = [&cs](bool result) {
403400 if (cs.isDebugMode ()) {
404- auto &log = C. TypeCheckerDebug -> getStream ();
405- log << " comparison result: " << (result ? " better" : " not better" )
406- << " \n " ;
401+ llvm::errs () << " comparison result: "
402+ << (result ? " better" : " not better" )
403+ << " \n " ;
407404 }
408405 return result;
409406 };
@@ -738,8 +735,7 @@ SolutionCompareResult ConstraintSystem::compareSolutions(
738735 ConstraintSystem &cs, ArrayRef<Solution> solutions,
739736 const SolutionDiff &diff, unsigned idx1, unsigned idx2) {
740737 if (cs.isDebugMode ()) {
741- auto &log = cs.getASTContext ().TypeCheckerDebug ->getStream ();
742- log.indent (cs.solverState ->depth * 2 )
738+ llvm::errs ().indent (cs.solverState ->depth * 2 )
743739 << " comparing solutions " << idx1 << " and " << idx2 <<" \n " ;
744740 }
745741
@@ -1262,13 +1258,13 @@ ConstraintSystem::findBestSolution(SmallVectorImpl<Solution> &viable,
12621258 return 0 ;
12631259
12641260 if (isDebugMode ()) {
1265- auto &log = getASTContext ().TypeCheckerDebug ->getStream ();
1266- log.indent (solverState->depth * 2 )
1261+ llvm::errs ().indent (solverState->depth * 2 )
12671262 << " Comparing " << viable.size () << " viable solutions\n " ;
12681263
12691264 for (unsigned i = 0 , n = viable.size (); i != n; ++i) {
1270- log.indent (solverState->depth * 2 ) << " --- Solution #" << i << " ---\n " ;
1271- viable[i].dump (log.indent (solverState->depth * 2 ));
1265+ llvm::errs ().indent (solverState->depth * 2 )
1266+ << " --- Solution #" << i << " ---\n " ;
1267+ viable[i].dump (llvm::errs ().indent (solverState->depth * 2 ));
12721268 }
12731269 }
12741270
0 commit comments