@@ -154,10 +154,9 @@ emitBridgeNativeToObjectiveC(SILGenFunction &SGF,
154
154
}
155
155
156
156
// Call the witness.
157
- SILType resultTy = SGF.getLoweredType (objcType);
158
157
SILValue bridgedValue =
159
- SGF.B .createApply (loc, witnessRef, witnessFnTy, resultTy, typeSubMap,
160
- swiftValue.borrow (SGF, loc).getValue ());
158
+ SGF.B .createApply (loc, witnessRef, typeSubMap,
159
+ swiftValue.borrow (SGF, loc).getValue (), false );
161
160
162
161
auto bridgedMV = SGF.emitManagedRValueWithCleanup (bridgedValue);
163
162
bridgedMV = scope.popPreservingValue (bridgedMV);
@@ -252,11 +251,8 @@ static ManagedValue emitBridgeBoolToObjCBool(SILGenFunction &SGF,
252
251
SILValue boolToObjCBoolFn
253
252
= SGF.emitGlobalFunctionRef (loc, SGF.SGM .getBoolToObjCBoolFn ());
254
253
255
- SILType resultTy =SGF.getLoweredLoadableType (SGF.SGM .Types .getObjCBoolType ());
256
-
257
254
SILValue result = SGF.B .createApply (loc, boolToObjCBoolFn,
258
- boolToObjCBoolFn->getType (),
259
- resultTy, {}, swiftBool.forward (SGF));
255
+ {}, swiftBool.forward (SGF), false );
260
256
return SGF.emitManagedRValueWithCleanup (result);
261
257
}
262
258
@@ -267,12 +263,8 @@ static ManagedValue emitBridgeBoolToDarwinBoolean(SILGenFunction &SGF,
267
263
SILValue boolToDarwinBooleanFn
268
264
= SGF.emitGlobalFunctionRef (loc, SGF.SGM .getBoolToDarwinBooleanFn ());
269
265
270
- SILType resultTy =
271
- SGF.getLoweredLoadableType (SGF.SGM .Types .getDarwinBooleanType ());
272
-
273
266
SILValue result = SGF.B .createApply (loc, boolToDarwinBooleanFn,
274
- boolToDarwinBooleanFn->getType (),
275
- resultTy, {}, swiftBool.forward (SGF));
267
+ {}, swiftBool.forward (SGF), false );
276
268
return SGF.emitManagedRValueWithCleanup (result);
277
269
}
278
270
@@ -283,10 +275,8 @@ static ManagedValue emitBridgeForeignBoolToBool(SILGenFunction &SGF,
283
275
// func _convertObjCBoolToBool(ObjCBool) -> Bool
284
276
SILValue bridgingFn = SGF.emitGlobalFunctionRef (loc, bridgingFnRef);
285
277
286
- SILType resultTy = SGF.getLoweredLoadableType (SGF.SGM .Types .getBoolType ());
287
-
288
- SILValue result = SGF.B .createApply (loc, bridgingFn, bridgingFn->getType (),
289
- resultTy, {}, foreignBool.forward (SGF));
278
+ SILValue result = SGF.B .createApply (loc, bridgingFn, {},
279
+ foreignBool.forward (SGF), false );
290
280
return SGF.emitManagedRValueWithCleanup (result);
291
281
}
292
282
@@ -960,9 +950,8 @@ SILGenFunction::emitBlockToFunc(SILLocation loc,
960
950
// Create it in the current function.
961
951
auto thunkValue = B.createFunctionRefFor (loc, thunk);
962
952
ManagedValue thunkedFn = B.createPartialApply (
963
- loc, thunkValue, SILType::getPrimitiveObjectType (substFnTy),
964
- interfaceSubs, block,
965
- SILType::getPrimitiveObjectType (loweredFuncTyWithoutNoEscape));
953
+ loc, thunkValue, interfaceSubs, block,
954
+ loweredFuncTy->getCalleeConvention ());
966
955
967
956
if (!loweredFuncTy->isNoEscape ()) {
968
957
return thunkedFn;
@@ -1143,18 +1132,17 @@ ManagedValue SILGenFunction::emitBridgedToNativeError(SILLocation loc,
1143
1132
// a standard error for a nil NSError.
1144
1133
auto bridgeFn = emitGlobalFunctionRef (loc, SGM.getNSErrorToErrorFn ());
1145
1134
auto bridgeFnType = bridgeFn->getType ().castTo <SILFunctionType>();
1146
- SILFunctionConventions bridgeFnConv (bridgeFnType, SGM.M );
1147
1135
assert (bridgeFnType->getNumResults () == 1 );
1148
1136
assert (bridgeFnType->getResults ()[0 ].getConvention ()
1149
1137
== ResultConvention::Owned);
1150
- auto nativeErrorType = bridgeFnConv.getSILType (bridgeFnType->getResults ()[0 ]);
1151
1138
1152
- assert (bridgeFnType->getParameters ()[0 ].getConvention () ==
1153
- ParameterConvention::Direct_Guaranteed);
1139
+ assert (bridgeFnType->getParameters ()[0 ].getConvention ()
1140
+ == ParameterConvention::Direct_Guaranteed);
1141
+ (void ) bridgeFnType;
1142
+
1154
1143
SILValue arg = bridgedError.getValue ();
1155
1144
1156
- SILValue nativeError = B.createApply (loc, bridgeFn, bridgeFn->getType (),
1157
- nativeErrorType, {}, arg);
1145
+ SILValue nativeError = B.createApply (loc, bridgeFn, {}, arg, false );
1158
1146
return emitManagedRValueWithCleanup (nativeError);
1159
1147
}
1160
1148
@@ -1191,19 +1179,16 @@ ManagedValue SILGenFunction::emitNativeToBridgedError(SILLocation loc,
1191
1179
1192
1180
auto bridgeFn = emitGlobalFunctionRef (loc, SGM.getErrorToNSErrorFn ());
1193
1181
auto bridgeFnType = bridgeFn->getType ().castTo <SILFunctionType>();
1194
- SILFunctionConventions bridgeFnConv (bridgeFnType, SGM.M );
1195
1182
assert (bridgeFnType->getNumResults () == 1 );
1196
1183
assert (bridgeFnType->getResults ()[0 ].getConvention ()
1197
1184
== ResultConvention::Owned);
1198
- auto loweredBridgedErrorType =
1199
- bridgeFnConv.getSILType (bridgeFnType->getResults ()[0 ]);
1185
+ assert (bridgeFnType->getParameters ()[0 ].getConvention ()
1186
+ == ParameterConvention::Direct_Guaranteed);
1187
+ (void ) bridgeFnType;
1200
1188
1201
- assert (bridgeFnType->getParameters ()[0 ].getConvention () ==
1202
- ParameterConvention::Direct_Guaranteed);
1203
1189
SILValue arg = nativeError.getValue ();
1204
1190
1205
- SILValue bridgedError = B.createApply (loc, bridgeFn, bridgeFn->getType (),
1206
- loweredBridgedErrorType, {}, arg);
1191
+ SILValue bridgedError = B.createApply (loc, bridgeFn, {}, arg, false );
1207
1192
return emitManagedRValueWithCleanup (bridgedError);
1208
1193
}
1209
1194
@@ -1405,7 +1390,6 @@ void SILGenFunction::emitNativeToForeignThunk(SILDeclRef thunk) {
1405
1390
auto nativeInfo = getConstantInfo (native);
1406
1391
auto subs = F.getForwardingSubstitutionMap ();
1407
1392
auto substTy = nativeInfo.SILFnType ->substGenericArgs (SGM.M , subs);
1408
- SILType substSILTy = SILType::getPrimitiveObjectType (substTy);
1409
1393
SILFunctionConventions substConv (substTy, SGM.M );
1410
1394
1411
1395
// Use the same generic environment as the native entry point.
@@ -1506,8 +1490,7 @@ void SILGenFunction::emitNativeToForeignThunk(SILDeclRef thunk) {
1506
1490
assert (foreignError.hasValue () == substTy->hasErrorResult ());
1507
1491
if (!substTy->hasErrorResult ()) {
1508
1492
// Create the apply.
1509
- result = B.createApply (loc, nativeFn, substSILTy,
1510
- swiftResultTy, subs, args);
1493
+ result = B.createApply (loc, nativeFn, subs, args, false );
1511
1494
1512
1495
if (substConv.hasIndirectSILResults ()) {
1513
1496
assert (substTy->getNumResults () == 1 );
@@ -1525,8 +1508,7 @@ void SILGenFunction::emitNativeToForeignThunk(SILDeclRef thunk) {
1525
1508
SILBasicBlock *contBB = createBasicBlock ();
1526
1509
SILBasicBlock *errorBB = createBasicBlock ();
1527
1510
SILBasicBlock *normalBB = createBasicBlock ();
1528
- B.createTryApply (loc, nativeFn, substSILTy, subs, args,
1529
- normalBB, errorBB);
1511
+ B.createTryApply (loc, nativeFn, subs, args, normalBB, errorBB);
1530
1512
1531
1513
// Emit the non-error destination.
1532
1514
{
0 commit comments