@@ -2800,6 +2800,11 @@ static void dumpProtocolConformanceRec(
2800
2800
unsigned indent,
2801
2801
llvm::SmallPtrSetImpl<const ProtocolConformance *> &visited);
2802
2802
2803
+ static void dumpSubstitutionMapRec (
2804
+ SubstitutionMap map, llvm::raw_ostream &out,
2805
+ SubstitutionMap::DumpStyle style, unsigned indent,
2806
+ llvm::SmallPtrSetImpl<const ProtocolConformance *> &visited);
2807
+
2803
2808
static void dumpProtocolConformanceRefRec (
2804
2809
const ProtocolConformanceRef conformance, llvm::raw_ostream &out,
2805
2810
unsigned indent,
@@ -2905,8 +2910,9 @@ static void dumpProtocolConformanceRec(
2905
2910
break ;
2906
2911
2907
2912
out << ' \n ' ;
2908
- conf->getSubstitutionMap ().dump (out, SubstitutionMap::DumpStyle::Full,
2909
- indent + 2 );
2913
+ dumpSubstitutionMapRec (conf->getSubstitutionMap (), out,
2914
+ SubstitutionMap::DumpStyle::Full, indent + 2 ,
2915
+ visited);
2910
2916
out << ' \n ' ;
2911
2917
for (auto subReq : conf->getConditionalRequirements ()) {
2912
2918
out.indent (indent + 2 );
@@ -2922,31 +2928,11 @@ static void dumpProtocolConformanceRec(
2922
2928
PrintWithColorRAII (out, ParenthesisColor) << ' )' ;
2923
2929
}
2924
2930
2925
- void ProtocolConformanceRef::dump () const {
2926
- dump (llvm::errs ());
2927
- llvm::errs () << ' \n ' ;
2928
- }
2929
-
2930
- void ProtocolConformanceRef::dump (llvm::raw_ostream &out,
2931
- unsigned indent) const {
2932
- llvm::SmallPtrSet<const ProtocolConformance *, 8 > visited;
2933
- dumpProtocolConformanceRefRec (*this , out, indent, visited);
2934
- }
2935
- void ProtocolConformance::dump () const {
2936
- auto &out = llvm::errs ();
2937
- dump (out);
2938
- out << ' \n ' ;
2939
- }
2940
-
2941
- void ProtocolConformance::dump (llvm::raw_ostream &out, unsigned indent) const {
2942
- llvm::SmallPtrSet<const ProtocolConformance *, 8 > visited;
2943
- dumpProtocolConformanceRec (this , out, indent, visited);
2944
- }
2945
-
2946
- void SubstitutionMap::dump (llvm::raw_ostream &out,
2947
- SubstitutionMap::DumpStyle style,
2948
- unsigned indent) const {
2949
- auto *genericSig = getGenericSignature ();
2931
+ static void dumpSubstitutionMapRec (
2932
+ SubstitutionMap map, llvm::raw_ostream &out,
2933
+ SubstitutionMap::DumpStyle style, unsigned indent,
2934
+ llvm::SmallPtrSetImpl<const ProtocolConformance *> &visited) {
2935
+ auto *genericSig = map.getGenericSignature ();
2950
2936
out.indent (indent);
2951
2937
2952
2938
auto printParen = [&](char p) {
@@ -2962,7 +2948,8 @@ void SubstitutionMap::dump(llvm::raw_ostream &out,
2962
2948
2963
2949
genericSig->print (out);
2964
2950
auto genericParams = genericSig->getGenericParams ();
2965
- auto replacementTypes = getReplacementTypesBuffer ();
2951
+ auto replacementTypes =
2952
+ static_cast <const SubstitutionMap &>(map).getReplacementTypesBuffer ();
2966
2953
for (unsigned i : indices (genericParams)) {
2967
2954
if (style == SubstitutionMap::DumpStyle::Minimal) {
2968
2955
out << " " ;
@@ -2985,9 +2972,7 @@ void SubstitutionMap::dump(llvm::raw_ostream &out,
2985
2972
if (style == SubstitutionMap::DumpStyle::Minimal)
2986
2973
return ;
2987
2974
2988
- // We only really need to print a conformance once across this whole map.
2989
- llvm::SmallPtrSet<const ProtocolConformance *, 8 > visited;
2990
- auto conformances = getConformances ();
2975
+ auto conformances = map.getConformances ();
2991
2976
for (const auto &req : genericSig->getRequirements ()) {
2992
2977
if (req.getKind () != RequirementKind::Conformance)
2993
2978
continue ;
@@ -3006,6 +2991,33 @@ void SubstitutionMap::dump(llvm::raw_ostream &out,
3006
2991
}
3007
2992
}
3008
2993
2994
+ void ProtocolConformanceRef::dump () const {
2995
+ dump (llvm::errs ());
2996
+ llvm::errs () << ' \n ' ;
2997
+ }
2998
+
2999
+ void ProtocolConformanceRef::dump (llvm::raw_ostream &out,
3000
+ unsigned indent) const {
3001
+ llvm::SmallPtrSet<const ProtocolConformance *, 8 > visited;
3002
+ dumpProtocolConformanceRefRec (*this , out, indent, visited);
3003
+ }
3004
+ void ProtocolConformance::dump () const {
3005
+ auto &out = llvm::errs ();
3006
+ dump (out);
3007
+ out << ' \n ' ;
3008
+ }
3009
+
3010
+ void ProtocolConformance::dump (llvm::raw_ostream &out, unsigned indent) const {
3011
+ llvm::SmallPtrSet<const ProtocolConformance *, 8 > visited;
3012
+ dumpProtocolConformanceRec (this , out, indent, visited);
3013
+ }
3014
+
3015
+ void SubstitutionMap::dump (llvm::raw_ostream &out, DumpStyle style,
3016
+ unsigned indent) const {
3017
+ llvm::SmallPtrSet<const ProtocolConformance *, 8 > visited;
3018
+ dumpSubstitutionMapRec (*this , out, style, indent, visited);
3019
+ }
3020
+
3009
3021
void SubstitutionMap::dump () const {
3010
3022
dump (llvm::errs ());
3011
3023
llvm::errs () << " \n " ;
0 commit comments