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
18
18
///
19
19
/// Substitution maps are primarily used when performing substitutions into any entity that
20
20
/// can reference type parameters and conformances.
21
- public struct SubstitutionMap {
21
+ public struct SubstitutionMap : CustomStringConvertible {
22
22
public let bridged : BridgedSubstitutionMap
23
23
24
24
public init ( bridged: BridgedSubstitutionMap ) {
@@ -29,6 +29,10 @@ public struct SubstitutionMap {
29
29
self . bridged = BridgedSubstitutionMap ( )
30
30
}
31
31
32
+ public var description : String {
33
+ return String ( taking: bridged. getDebugDescription ( ) )
34
+ }
35
+
32
36
public var isEmpty : Bool { bridged. isEmpty ( ) }
33
37
34
38
public var hasAnySubstitutableParams : Bool { bridged. hasAnySubstitutableParams ( ) }
Original file line number Diff line number Diff line change @@ -2070,6 +2070,7 @@ struct BridgedSubstitutionMap {
2070
2070
BRIDGED_INLINE BridgedSubstitutionMap (swift::SubstitutionMap map);
2071
2071
BRIDGED_INLINE swift::SubstitutionMap unbridged () const ;
2072
2072
BRIDGED_INLINE BridgedSubstitutionMap ();
2073
+ BridgedOwnedString getDebugDescription () const ;
2073
2074
BRIDGED_INLINE bool isEmpty () const ;
2074
2075
BRIDGED_INLINE bool hasAnySubstitutableParams () const ;
2075
2076
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(); }
51
51
52
52
#pragma clang diagnostic pop
53
53
54
+ // ===----------------------------------------------------------------------===//
55
+ // MARK: Conformance
56
+ // ===----------------------------------------------------------------------===//
57
+
54
58
BridgedOwnedString BridgedConformance::getDebugDescription () const {
55
59
std::string str;
56
60
llvm::raw_string_ostream os (str);
57
61
unbridged ().print (os);
58
62
return str;
59
63
}
60
64
65
+ // ===----------------------------------------------------------------------===//
66
+ // MARK: SubstitutionMap
67
+ // ===----------------------------------------------------------------------===//
68
+
61
69
static_assert (sizeof (BridgedSubstitutionMap) >= sizeof(swift::SubstitutionMap),
62
70
"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