File tree Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -192,6 +192,12 @@ class GenericSignatureBuilder {
192
192
// / Determine whether conformance to the given protocol is satisfied by
193
193
// / a superclass requirement.
194
194
bool isConformanceSatisfiedBySuperclass (ProtocolDecl *proto) const ;
195
+
196
+ // / Dump a debugging representation of this equivalence class.
197
+ void dump (llvm::raw_ostream &out) const ;
198
+
199
+ LLVM_ATTRIBUTE_DEPRECATED (void dump () const ,
200
+ "only for use in the debugger");
195
201
};
196
202
197
203
friend class RequirementSource ;
Original file line number Diff line number Diff line change @@ -1083,6 +1083,50 @@ bool EquivalenceClass::isConformanceSatisfiedBySuperclass(
1083
1083
return false ;
1084
1084
}
1085
1085
1086
+ void EquivalenceClass::dump (llvm::raw_ostream &out) const {
1087
+ out << " Equivalence class represented by "
1088
+ << members.front ()->getRepresentative ()->getDebugName () << " :\n " ;
1089
+ out << " Members: " ;
1090
+ interleave (members, [&](PotentialArchetype *pa) {
1091
+ out << pa->getDebugName ();
1092
+ }, [&]() {
1093
+ out << " , " ;
1094
+ });
1095
+ out << " \n Conformances:" ;
1096
+ interleave (conformsTo,
1097
+ [&](const std::pair<
1098
+ ProtocolDecl *,
1099
+ std::vector<Constraint<ProtocolDecl *>>> &entry) {
1100
+ out << entry.first ->getNameStr ();
1101
+ },
1102
+ [&] { out << " , " ; });
1103
+ out << " \n Same-type constraints:" ;
1104
+ for (const auto &entry : sameTypeConstraints) {
1105
+ out << " \n " << entry.first ->getDebugName () << " == " ;
1106
+ interleave (entry.second ,
1107
+ [&](const Constraint<PotentialArchetype *> &constraint) {
1108
+ out << constraint.value ->getDebugName ();
1109
+
1110
+ if (constraint.source ->isDerivedRequirement ())
1111
+ out << " [derived]" ;
1112
+ }, [&] {
1113
+ out << " , " ;
1114
+ });
1115
+ }
1116
+ if (concreteType)
1117
+ out << " \n Concrete type: " << concreteType.getString ();
1118
+ if (superclass)
1119
+ out << " \n Superclass: " << superclass.getString ();
1120
+ if (layout)
1121
+ out << " \n Layout: " << layout.getString ();
1122
+
1123
+ out << " \n " ;
1124
+ }
1125
+
1126
+ void EquivalenceClass::dump () const {
1127
+ dump (llvm::errs ());
1128
+ }
1129
+
1086
1130
ConstraintResult GenericSignatureBuilder::handleUnresolvedRequirement (
1087
1131
RequirementKind kind,
1088
1132
UnresolvedType lhs,
You can’t perform that action at this time.
0 commit comments