@@ -36,61 +36,60 @@ void ConstraintSystem::increaseScore(ScoreKind kind, unsigned value) {
36
36
CurrentScore.Data [index] += value;
37
37
38
38
if (isDebugMode () && value > 0 ) {
39
- auto &log = getASTContext ().TypeCheckerDebug ->getStream ();
40
39
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 " ;
43
42
switch (kind) {
44
43
case SK_Hole:
45
- log << " hole in the constraint system" ;
44
+ llvm::errs () << " hole in the constraint system" ;
46
45
break ;
47
46
48
47
case SK_Unavailable:
49
- log << " use of an unavailable declaration" ;
48
+ llvm::errs () << " use of an unavailable declaration" ;
50
49
break ;
51
50
52
51
case SK_Fix:
53
- log << " attempting to fix the source" ;
52
+ llvm::errs () << " attempting to fix the source" ;
54
53
break ;
55
54
56
55
case SK_DisfavoredOverload:
57
- log << " disfavored overload" ;
56
+ llvm::errs () << " disfavored overload" ;
58
57
break ;
59
58
60
59
case SK_ForceUnchecked:
61
- log << " force of an implicitly unwrapped optional" ;
60
+ llvm::errs () << " force of an implicitly unwrapped optional" ;
62
61
break ;
63
62
64
63
case SK_UserConversion:
65
- log << " user conversion" ;
64
+ llvm::errs () << " user conversion" ;
66
65
break ;
67
66
68
67
case SK_FunctionConversion:
69
- log << " function conversion" ;
68
+ llvm::errs () << " function conversion" ;
70
69
break ;
71
70
72
71
case SK_NonDefaultLiteral:
73
- log << " non-default literal" ;
72
+ llvm::errs () << " non-default literal" ;
74
73
break ;
75
74
76
75
case SK_CollectionUpcastConversion:
77
- log << " collection upcast conversion" ;
76
+ llvm::errs () << " collection upcast conversion" ;
78
77
break ;
79
78
80
79
case SK_ValueToOptional:
81
- log << " value to optional" ;
80
+ llvm::errs () << " value to optional" ;
82
81
break ;
83
82
case SK_EmptyExistentialConversion:
84
- log << " empty-existential conversion" ;
83
+ llvm::errs () << " empty-existential conversion" ;
85
84
break ;
86
85
case SK_KeyPathSubscript:
87
- log << " key path subscript" ;
86
+ llvm::errs () << " key path subscript" ;
88
87
break ;
89
88
case SK_ValueToPointerConversion:
90
- log << " value-to-pointer conversion" ;
89
+ llvm::errs () << " value-to-pointer conversion" ;
91
90
break ;
92
91
}
93
- log << " )\n " ;
92
+ llvm::errs () << " )\n " ;
94
93
}
95
94
}
96
95
@@ -103,8 +102,7 @@ bool ConstraintSystem::worseThanBestSolution() const {
103
102
return false ;
104
103
105
104
if (isDebugMode ()) {
106
- auto &log = getASTContext ().TypeCheckerDebug ->getStream ();
107
- log.indent (solverState->depth * 2 )
105
+ llvm::errs ().indent (solverState->depth * 2 )
108
106
<< " (solution is worse than the best solution)\n " ;
109
107
}
110
108
@@ -389,21 +387,20 @@ bool CompareDeclSpecializationRequest::evaluate(
389
387
// Construct a constraint system to compare the two declarations.
390
388
ConstraintSystem cs (dc, ConstraintSystemOptions ());
391
389
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 " ;
400
397
}
401
398
402
- auto completeResult = [&C, & cs](bool result) {
399
+ auto completeResult = [&cs](bool result) {
403
400
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 " ;
407
404
}
408
405
return result;
409
406
};
@@ -738,8 +735,7 @@ SolutionCompareResult ConstraintSystem::compareSolutions(
738
735
ConstraintSystem &cs, ArrayRef<Solution> solutions,
739
736
const SolutionDiff &diff, unsigned idx1, unsigned idx2) {
740
737
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 )
743
739
<< " comparing solutions " << idx1 << " and " << idx2 <<" \n " ;
744
740
}
745
741
@@ -1262,13 +1258,13 @@ ConstraintSystem::findBestSolution(SmallVectorImpl<Solution> &viable,
1262
1258
return 0 ;
1263
1259
1264
1260
if (isDebugMode ()) {
1265
- auto &log = getASTContext ().TypeCheckerDebug ->getStream ();
1266
- log.indent (solverState->depth * 2 )
1261
+ llvm::errs ().indent (solverState->depth * 2 )
1267
1262
<< " Comparing " << viable.size () << " viable solutions\n " ;
1268
1263
1269
1264
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 ));
1272
1268
}
1273
1269
}
1274
1270
0 commit comments