@@ -148,6 +148,10 @@ enum class BridgedArgumentConvention {
148
148
struct BridgedParameterInfo {
149
149
swift::TypeBase * _Nonnull type;
150
150
BridgedArgumentConvention convention;
151
+ uint8_t options;
152
+
153
+ BridgedParameterInfo (swift::TypeBase * _Nonnull type, BridgedArgumentConvention convention, uint8_t options) :
154
+ type (type), convention(convention), options(options) {}
151
155
152
156
#ifdef USED_IN_CPP_SOURCE
153
157
inline static BridgedArgumentConvention
@@ -156,10 +160,34 @@ struct BridgedParameterInfo {
156
160
swift::SILArgumentConvention (convention).Value );
157
161
}
158
162
163
+ swift::ParameterConvention getParameterConvention () const {
164
+ switch (convention) {
165
+ case BridgedArgumentConvention::Indirect_In: return swift::ParameterConvention::Indirect_In;
166
+ case BridgedArgumentConvention::Indirect_In_Guaranteed: return swift::ParameterConvention::Indirect_In_Guaranteed;
167
+ case BridgedArgumentConvention::Indirect_Inout: return swift::ParameterConvention::Indirect_Inout;
168
+ case BridgedArgumentConvention::Indirect_InoutAliasable: return swift::ParameterConvention::Indirect_InoutAliasable;
169
+ case BridgedArgumentConvention::Indirect_Out: break ;
170
+ case BridgedArgumentConvention::Direct_Owned: return swift::ParameterConvention::Direct_Owned;
171
+ case BridgedArgumentConvention::Direct_Unowned: return swift::ParameterConvention::Direct_Unowned;
172
+ case BridgedArgumentConvention::Direct_Guaranteed: return swift::ParameterConvention::Direct_Guaranteed;
173
+ case BridgedArgumentConvention::Pack_Owned: return swift::ParameterConvention::Pack_Owned;
174
+ case BridgedArgumentConvention::Pack_Inout: return swift::ParameterConvention::Pack_Inout;
175
+ case BridgedArgumentConvention::Pack_Guaranteed: return swift::ParameterConvention::Pack_Guaranteed;
176
+ case BridgedArgumentConvention::Pack_Out: break ;
177
+ }
178
+ llvm_unreachable (" invalid parameter convention" );
179
+ }
180
+
159
181
BridgedParameterInfo (swift::SILParameterInfo parameterInfo):
160
182
type(parameterInfo.getInterfaceType().getPointer()),
161
- convention(castToArgumentConvention(parameterInfo.getConvention()))
183
+ convention(castToArgumentConvention(parameterInfo.getConvention())),
184
+ options(parameterInfo.getOptions().toRaw())
162
185
{}
186
+
187
+ swift::SILParameterInfo unbridged () const {
188
+ return swift::SILParameterInfo (swift::CanType (type), getParameterConvention (),
189
+ swift::SILParameterInfo::Options (options));
190
+ }
163
191
#endif
164
192
};
165
193
0 commit comments