@@ -805,8 +805,6 @@ namespace {
805
805
virtual void printSourceRange (const SourceRange R, const ASTContext *Ctx,
806
806
Label label) = 0;
807
807
808
- virtual bool hasNonStandardOutput () const = 0;
809
-
810
808
// / Indicates whether the output format is meant to be parsable. Parsable
811
809
// / output should use structure rather than stringification to convey
812
810
// / detailed information, and generally provides more information than the
@@ -900,10 +898,6 @@ namespace {
900
898
}, label, RangeColor);
901
899
}
902
900
903
- bool hasNonStandardOutput () const override {
904
- return &OS != &llvm::errs () && &OS != &llvm::dbgs ();
905
- }
906
-
907
901
bool isParsable () const override { return false ; }
908
902
};
909
903
@@ -1014,8 +1008,6 @@ namespace {
1014
1008
OS.attributeEnd ();
1015
1009
}
1016
1010
1017
- bool hasNonStandardOutput () const override { return true ; }
1018
-
1019
1011
bool isParsable () const override { return true ; }
1020
1012
};
1021
1013
@@ -1046,10 +1038,6 @@ namespace {
1046
1038
GetTypeOfExpr(getTypeOfExpr), GetTypeOfTypeRepr(getTypeOfTypeRepr),
1047
1039
GetTypeOfKeyPathComponent(getTypeOfKeyPathComponent) {}
1048
1040
1049
- bool hasNonStandardOutput () {
1050
- return Writer.hasNonStandardOutput ();
1051
- }
1052
-
1053
1041
bool isTypeChecked () const {
1054
1042
return MemberLoading == ASTDumpMemberLoading::TypeChecked;
1055
1043
}
@@ -3015,11 +3003,6 @@ void swift::printContext(raw_ostream &os, DeclContext *dc) {
3015
3003
<< " autoclosure discriminator=" ;
3016
3004
}
3017
3005
3018
- // If we aren't printing to standard error or the debugger output stream,
3019
- // this client expects to see the computed discriminator. Compute it now.
3020
- if (&os != &llvm::errs () && &os != &llvm::dbgs ())
3021
- (void )ACE->getDiscriminator ();
3022
-
3023
3006
PrintWithColorRAII (os, DiscriminatorColor) << ACE->getRawDiscriminator ();
3024
3007
break ;
3025
3008
}
@@ -4094,16 +4077,15 @@ class PrintExpr : public ExprVisitor<PrintExpr, void, Label>,
4094
4077
printFoot ();
4095
4078
}
4096
4079
4097
- void printClosure (AbstractClosureExpr *E, char const *name,
4098
- Label label) {
4080
+ void printClosure (AbstractClosureExpr *E, char const *name, Label label) {
4099
4081
printCommon (E, name, label);
4100
4082
4101
- // If we aren't printing to standard error or the debugger output stream,
4102
- // this client expects to see the computed discriminator. Compute it now .
4103
- if ( hasNonStandardOutput () )
4104
- ( void ) E->getDiscriminator ();
4083
+ // If we're dumping the type-checked AST, compute the discriminator if
4084
+ // needed. Otherwise, print the cached discriminator.
4085
+ auto discriminator = isTypeChecked () ? E-> getDiscriminator ( )
4086
+ : E->getRawDiscriminator ();
4105
4087
4106
- printField (E-> getRawDiscriminator () , Label::always (" discriminator" ),
4088
+ printField (discriminator , Label::always (" discriminator" ),
4107
4089
DiscriminatorColor);
4108
4090
printIsolation (E->getActorIsolation ());
4109
4091
0 commit comments