File tree Expand file tree Collapse file tree 3 files changed +22
-1
lines changed
SwiftCompilerSources/Sources/AST Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ import ASTBridging
1818///
1919/// Substitution maps are primarily used when performing substitutions into any entity that
2020/// can reference type parameters and conformances.
21- public struct SubstitutionMap {
21+ public struct SubstitutionMap : CustomStringConvertible {
2222 public let bridged : BridgedSubstitutionMap
2323
2424 public init ( bridged: BridgedSubstitutionMap ) {
@@ -29,6 +29,10 @@ public struct SubstitutionMap {
2929 self . bridged = BridgedSubstitutionMap ( )
3030 }
3131
32+ public var description : String {
33+ return String ( taking: bridged. getDebugDescription ( ) )
34+ }
35+
3236 public var isEmpty : Bool { bridged. isEmpty ( ) }
3337
3438 public var hasAnySubstitutableParams : Bool { bridged. hasAnySubstitutableParams ( ) }
Original file line number Diff line number Diff line change @@ -2070,6 +2070,7 @@ struct BridgedSubstitutionMap {
20702070 BRIDGED_INLINE BridgedSubstitutionMap (swift::SubstitutionMap map);
20712071 BRIDGED_INLINE swift::SubstitutionMap unbridged () const ;
20722072 BRIDGED_INLINE BridgedSubstitutionMap ();
2073+ BridgedOwnedString getDebugDescription () const ;
20732074 BRIDGED_INLINE bool isEmpty () const ;
20742075 BRIDGED_INLINE bool hasAnySubstitutableParams () const ;
20752076 BRIDGED_INLINE SwiftInt getNumConformances () const ;
Original file line number Diff line number Diff line change @@ -51,12 +51,28 @@ void BridgedTypeRepr_dump(void *type) { static_cast<TypeRepr *>(type)->dump(); }
5151
5252#pragma clang diagnostic pop
5353
54+ // ===----------------------------------------------------------------------===//
55+ // MARK: Conformance
56+ // ===----------------------------------------------------------------------===//
57+
5458BridgedOwnedString BridgedConformance::getDebugDescription () const {
5559 std::string str;
5660 llvm::raw_string_ostream os (str);
5761 unbridged ().print (os);
5862 return str;
5963}
6064
65+ // ===----------------------------------------------------------------------===//
66+ // MARK: SubstitutionMap
67+ // ===----------------------------------------------------------------------===//
68+
6169static_assert (sizeof (BridgedSubstitutionMap) >= sizeof (swift::SubstitutionMap),
6270 " BridgedSubstitutionMap has wrong size" );
71+
72+ BridgedOwnedString BridgedSubstitutionMap::getDebugDescription () const {
73+ std::string str;
74+ llvm::raw_string_ostream os (str);
75+ unbridged ().dump (os);
76+ return str;
77+ }
78+
You can’t perform that action at this time.
0 commit comments