@@ -47,6 +47,7 @@ namespace swift {
47
47
class ValueBase ;
48
48
class Operand ;
49
49
class ForwardingInstruction ;
50
+ class SILType ;
50
51
class SILFunction ;
51
52
class SILBasicBlock ;
52
53
class SILSuccessor ;
@@ -58,13 +59,19 @@ class SILVTableEntry;
58
59
class SILVTable ;
59
60
class SILWitnessTable ;
60
61
class SILDefaultWitnessTable ;
62
+ class SILDebugLocation ;
61
63
class NominalTypeDecl ;
62
64
class VarDecl ;
65
+ class Type ;
63
66
class TypeBase ;
67
+ class SubstitutionMap ;
64
68
class SwiftPassInvocation ;
65
69
class GenericSpecializationInformation ;
66
70
class LifetimeDependenceInfo ;
67
71
class IndexSubset ;
72
+ enum class ResultConvention : uint8_t ;
73
+ class SILResultInfo ;
74
+ class SILParameterInfo ;
68
75
}
69
76
70
77
bool swiftModulesInitialized ();
@@ -83,58 +90,18 @@ struct BridgedResultInfo {
83
90
swift::TypeBase * _Nonnull type;
84
91
BridgedResultConvention convention;
85
92
86
- // Ensure that this struct value type will be indirectly returned on
87
- // Windows ARM64
88
- BridgedResultInfo () {}
89
-
90
- #ifdef USED_IN_CPP_SOURCE
91
- inline static BridgedResultConvention
92
- castToResultConvention (swift::ResultConvention convention) {
93
- return static_cast <BridgedResultConvention>(convention);
94
- }
95
-
96
- BridgedResultInfo (swift::SILResultInfo resultInfo):
97
- type(resultInfo.getInterfaceType().getPointer()),
98
- convention(castToResultConvention(resultInfo.getConvention()))
99
- {}
100
- #endif
93
+ BRIDGED_INLINE static BridgedResultConvention castToResultConvention (swift::ResultConvention convention);
94
+ BRIDGED_INLINE BridgedResultInfo (swift::SILResultInfo resultInfo);
101
95
};
102
96
103
97
struct OptionalBridgedResultInfo {
104
- swift::TypeBase * _Nullable type = nullptr ;
105
- BridgedResultConvention convention = BridgedResultConvention::Indirect;
106
-
107
- // Ensure that this struct value type will be indirectly returned on
108
- // Windows ARM64
109
- OptionalBridgedResultInfo () {}
110
-
111
- #ifdef USED_IN_CPP_SOURCE
112
- OptionalBridgedResultInfo (std::optional<swift::SILResultInfo> resultInfo) {
113
- if (resultInfo) {
114
- type = resultInfo->getInterfaceType ().getPointer ();
115
- convention =
116
- BridgedResultInfo::castToResultConvention (resultInfo->getConvention ());
117
- }
118
- }
119
- #endif
98
+ swift::TypeBase * _Nullable type;
99
+ BridgedResultConvention convention;
120
100
};
121
101
122
102
struct BridgedResultInfoArray {
123
103
BridgedArrayRef resultInfoArray;
124
104
125
- // Ensure that this struct value type will be indirectly returned on
126
- // Windows ARM64
127
- BridgedResultInfoArray () {}
128
-
129
- #ifdef USED_IN_CPP_SOURCE
130
- BridgedResultInfoArray (llvm::ArrayRef<swift::SILResultInfo> results)
131
- : resultInfoArray(results) {}
132
-
133
- llvm::ArrayRef<swift::SILResultInfo> unbridged () const {
134
- return resultInfoArray.unbridged <swift::SILResultInfo>();
135
- }
136
- #endif
137
-
138
105
BRIDGED_INLINE SwiftInt count () const ;
139
106
140
107
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE
@@ -160,44 +127,6 @@ enum class BridgedArgumentConvention {
160
127
Pack_Out
161
128
};
162
129
163
- #ifdef USED_IN_CPP_SOURCE
164
- inline swift::ParameterConvention getParameterConvention (BridgedArgumentConvention convention) {
165
- switch (convention) {
166
- case BridgedArgumentConvention::Indirect_In: return swift::ParameterConvention::Indirect_In;
167
- case BridgedArgumentConvention::Indirect_In_Guaranteed: return swift::ParameterConvention::Indirect_In_Guaranteed;
168
- case BridgedArgumentConvention::Indirect_Inout: return swift::ParameterConvention::Indirect_Inout;
169
- case BridgedArgumentConvention::Indirect_InoutAliasable: return swift::ParameterConvention::Indirect_InoutAliasable;
170
- case BridgedArgumentConvention::Indirect_In_CXX: return swift::ParameterConvention::Indirect_In_CXX;
171
- case BridgedArgumentConvention::Indirect_Out: break ;
172
- case BridgedArgumentConvention::Direct_Owned: return swift::ParameterConvention::Direct_Owned;
173
- case BridgedArgumentConvention::Direct_Unowned: return swift::ParameterConvention::Direct_Unowned;
174
- case BridgedArgumentConvention::Direct_Guaranteed: return swift::ParameterConvention::Direct_Guaranteed;
175
- case BridgedArgumentConvention::Pack_Owned: return swift::ParameterConvention::Pack_Owned;
176
- case BridgedArgumentConvention::Pack_Inout: return swift::ParameterConvention::Pack_Inout;
177
- case BridgedArgumentConvention::Pack_Guaranteed: return swift::ParameterConvention::Pack_Guaranteed;
178
- case BridgedArgumentConvention::Pack_Out: break ;
179
- }
180
- llvm_unreachable (" invalid parameter convention" );
181
- }
182
-
183
- inline BridgedArgumentConvention getArgumentConvention (swift::ParameterConvention convention) {
184
- switch (convention) {
185
- case swift::ParameterConvention::Indirect_In: return BridgedArgumentConvention::Indirect_In;
186
- case swift::ParameterConvention::Indirect_In_Guaranteed: return BridgedArgumentConvention::Indirect_In_Guaranteed;
187
- case swift::ParameterConvention::Indirect_Inout: return BridgedArgumentConvention::Indirect_Inout;
188
- case swift::ParameterConvention::Indirect_InoutAliasable: return BridgedArgumentConvention::Indirect_InoutAliasable;
189
- case swift::ParameterConvention::Indirect_In_CXX: return BridgedArgumentConvention::Indirect_In_CXX;
190
- case swift::ParameterConvention::Direct_Owned: return BridgedArgumentConvention::Direct_Owned;
191
- case swift::ParameterConvention::Direct_Unowned: return BridgedArgumentConvention::Direct_Unowned;
192
- case swift::ParameterConvention::Direct_Guaranteed: return BridgedArgumentConvention::Direct_Guaranteed;
193
- case swift::ParameterConvention::Pack_Owned: return BridgedArgumentConvention::Pack_Owned;
194
- case swift::ParameterConvention::Pack_Inout: return BridgedArgumentConvention::Pack_Inout;
195
- case swift::ParameterConvention::Pack_Guaranteed: return BridgedArgumentConvention::Pack_Guaranteed;
196
- }
197
- llvm_unreachable (" invalid parameter convention" );
198
- }
199
- #endif
200
-
201
130
struct BridgedParameterInfo {
202
131
swift::TypeBase * _Nonnull type;
203
132
BridgedArgumentConvention convention;
@@ -206,42 +135,13 @@ struct BridgedParameterInfo {
206
135
BridgedParameterInfo (swift::TypeBase * _Nonnull type, BridgedArgumentConvention convention, uint8_t options) :
207
136
type (type), convention(convention), options(options) {}
208
137
209
- #ifdef USED_IN_CPP_SOURCE
210
- inline static BridgedArgumentConvention
211
- castToArgumentConvention (swift::ParameterConvention convention) {
212
- return static_cast <BridgedArgumentConvention>(
213
- swift::SILArgumentConvention (convention).Value );
214
- }
215
-
216
- BridgedParameterInfo (swift::SILParameterInfo parameterInfo):
217
- type(parameterInfo.getInterfaceType().getPointer()),
218
- convention(castToArgumentConvention(parameterInfo.getConvention())),
219
- options(parameterInfo.getOptions().toRaw())
220
- {}
221
-
222
- swift::SILParameterInfo unbridged () const {
223
- return swift::SILParameterInfo (swift::CanType (type), getParameterConvention (convention),
224
- swift::SILParameterInfo::Options (options));
225
- }
226
- #endif
138
+ BRIDGED_INLINE BridgedParameterInfo (swift::SILParameterInfo parameterInfo);
139
+ BRIDGED_INLINE swift::SILParameterInfo unbridged () const ;
227
140
};
228
141
229
142
struct BridgedParameterInfoArray {
230
143
BridgedArrayRef parameterInfoArray;
231
144
232
- // Ensure that this struct value type will be indirectly returned on
233
- // Windows ARM64
234
- BridgedParameterInfoArray () {}
235
-
236
- #ifdef USED_IN_CPP_SOURCE
237
- BridgedParameterInfoArray (llvm::ArrayRef<swift::SILParameterInfo> parameters)
238
- : parameterInfoArray(parameters) {}
239
-
240
- llvm::ArrayRef<swift::SILParameterInfo> unbridged () const {
241
- return parameterInfoArray.unbridged <swift::SILParameterInfo>();
242
- }
243
- #endif
244
-
245
145
BRIDGED_INLINE SwiftInt count () const ;
246
146
247
147
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE
@@ -251,19 +151,6 @@ struct BridgedParameterInfoArray {
251
151
struct BridgedYieldInfoArray {
252
152
BridgedArrayRef yieldInfoArray;
253
153
254
- // Ensure that this struct value type will be indirectly returned on
255
- // Windows ARM64
256
- BridgedYieldInfoArray () {}
257
-
258
- #ifdef USED_IN_CPP_SOURCE
259
- BridgedYieldInfoArray (llvm::ArrayRef<swift::SILYieldInfo> yields)
260
- : yieldInfoArray(yields) {}
261
-
262
- llvm::ArrayRef<swift::SILYieldInfo> unbridged () const {
263
- return yieldInfoArray.unbridged <swift::SILYieldInfo>();
264
- }
265
- #endif
266
-
267
154
BRIDGED_INLINE SwiftInt count () const ;
268
155
269
156
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE
@@ -275,16 +162,7 @@ struct BridgedLifetimeDependenceInfo {
275
162
SwiftUInt targetIndex;
276
163
bool immortal;
277
164
278
- // Ensure that this struct value type will be indirectly returned on
279
- // Windows ARM64
280
- BridgedLifetimeDependenceInfo () {}
281
-
282
- #ifdef USED_IN_CPP_SOURCE
283
- BridgedLifetimeDependenceInfo (swift::LifetimeDependenceInfo info)
284
- : inheritLifetimeParamIndices(info.getInheritIndices()),
285
- scopeLifetimeParamIndices(info.getScopeIndices()),
286
- targetIndex(info.getTargetIndex()), immortal(info.isImmortal()) {}
287
- #endif
165
+ BRIDGED_INLINE BridgedLifetimeDependenceInfo (swift::LifetimeDependenceInfo info);
288
166
289
167
BRIDGED_INLINE bool empty () const ;
290
168
BRIDGED_INLINE bool checkInherit (SwiftInt index) const ;
@@ -297,21 +175,6 @@ struct BridgedLifetimeDependenceInfo {
297
175
struct BridgedLifetimeDependenceInfoArray {
298
176
BridgedArrayRef lifetimeDependenceInfoArray;
299
177
300
- // Ensure that this struct value type will be indirectly returned on
301
- // Windows ARM64
302
- BridgedLifetimeDependenceInfoArray () {}
303
-
304
- #ifdef USED_IN_CPP_SOURCE
305
- BridgedLifetimeDependenceInfoArray (
306
- llvm::ArrayRef<swift::LifetimeDependenceInfo> lifetimeDependenceInfo)
307
- : lifetimeDependenceInfoArray(lifetimeDependenceInfo) {}
308
-
309
- llvm::ArrayRef<swift::LifetimeDependenceInfo> unbridged () const {
310
- return lifetimeDependenceInfoArray
311
- .unbridged <swift::LifetimeDependenceInfo>();
312
- }
313
- #endif
314
-
315
178
BRIDGED_INLINE SwiftInt count () const ;
316
179
317
180
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedLifetimeDependenceInfo
@@ -335,11 +198,7 @@ enum class BridgedLinkage {
335
198
struct BridgedASTType {
336
199
swift::TypeBase * _Nullable type;
337
200
338
- #ifdef USED_IN_CPP_SOURCE
339
- swift::Type unbridged () const {
340
- return type;
341
- }
342
- #endif
201
+ BRIDGED_INLINE swift::Type unbridged () const ;
343
202
344
203
BRIDGED_INLINE BridgedOwnedString getDebugDescription () const ;
345
204
@@ -418,17 +277,8 @@ struct BridgedType {
418
277
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE EnumElementIterator getNext () const ;
419
278
};
420
279
421
- // Ensure that this struct value type will be indirectly returned on
422
- // Windows ARM64
423
- BridgedType () {}
424
-
425
- #ifdef USED_IN_CPP_SOURCE
426
- BridgedType (swift::SILType t) : opaqueValue(t.getOpaqueValue()) {}
427
-
428
- swift::SILType unbridged () const {
429
- return swift::SILType::getFromOpaqueValue (opaqueValue);
430
- }
431
- #endif
280
+ BRIDGED_INLINE BridgedType (swift::SILType t);
281
+ BRIDGED_INLINE swift::SILType unbridged () const ;
432
282
433
283
BRIDGED_INLINE BridgedOwnedString getDebugDescription () const ;
434
284
BRIDGED_INLINE bool isNull () const ;
@@ -609,18 +459,8 @@ enum class BridgedMemoryBehavior {
609
459
struct BridgedLocation {
610
460
uint64_t storage[3 ];
611
461
612
- // Ensure that this struct value type will be indirectly returned on
613
- // Windows ARM64
614
- BridgedLocation () {}
615
-
616
- #ifdef USED_IN_CPP_SOURCE
617
- BridgedLocation (const swift::SILDebugLocation &loc) {
618
- *reinterpret_cast <swift::SILDebugLocation *>(&storage) = loc;
619
- }
620
- const swift::SILDebugLocation &getLoc () const {
621
- return *reinterpret_cast <const swift::SILDebugLocation *>(&storage);
622
- }
623
- #endif
462
+ BRIDGED_INLINE BridgedLocation (const swift::SILDebugLocation &loc);
463
+ BRIDGED_INLINE const swift::SILDebugLocation &getLoc () const ;
624
464
625
465
BridgedOwnedString getDebugDescription () const ;
626
466
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedLocation getAutogeneratedLocation () const ;
@@ -790,28 +630,16 @@ struct OptionalBridgedGlobalVar {
790
630
struct BridgedMultiValueResult {
791
631
SwiftObject obj;
792
632
793
- #ifdef USED_IN_CPP_SOURCE
794
- swift::MultipleValueInstructionResult * _Nonnull unbridged () const {
795
- return static_cast <swift::MultipleValueInstructionResult *>(obj);
796
- }
797
- #endif
798
-
633
+ BRIDGED_INLINE swift::MultipleValueInstructionResult * _Nonnull unbridged () const ;
799
634
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedInstruction getParent () const ;
800
635
BRIDGED_INLINE SwiftInt getIndex () const ;
801
636
};
802
637
803
638
struct BridgedSubstitutionMap {
804
639
uint64_t storage[1 ];
805
640
806
- #ifdef USED_IN_CPP_SOURCE
807
- BridgedSubstitutionMap (swift::SubstitutionMap map) {
808
- *reinterpret_cast <swift::SubstitutionMap *>(&storage) = map;
809
- }
810
- swift::SubstitutionMap unbridged () const {
811
- return *reinterpret_cast <const swift::SubstitutionMap *>(&storage);
812
- }
813
- #endif
814
-
641
+ BRIDGED_INLINE BridgedSubstitutionMap (swift::SubstitutionMap map);
642
+ BRIDGED_INLINE swift::SubstitutionMap unbridged () const ;
815
643
BRIDGED_INLINE BridgedSubstitutionMap ();
816
644
BRIDGED_INLINE bool isEmpty () const ;
817
645
BRIDGED_INLINE bool hasAnySubstitutableParams () const ;
0 commit comments