@@ -1028,9 +1028,17 @@ class SILBuilder {
10281028 ConvertFunctionInst *createConvertFunction (SILLocation Loc, SILValue Op,
10291029 SILType Ty,
10301030 bool WithoutActuallyEscaping) {
1031- return insert (ConvertFunctionInst::create (getSILDebugLocation (Loc), Op, Ty,
1032- getModule (), F, C.OpenedArchetypes ,
1033- WithoutActuallyEscaping));
1031+ return createConvertFunction (Loc, Op, Ty, WithoutActuallyEscaping,
1032+ Op.getOwnershipKind ());
1033+ }
1034+
1035+ ConvertFunctionInst *
1036+ createConvertFunction (SILLocation Loc, SILValue Op, SILType Ty,
1037+ bool WithoutActuallyEscaping,
1038+ ValueOwnershipKind forwardingOwnershipKind) {
1039+ return insert (ConvertFunctionInst::create (
1040+ getSILDebugLocation (Loc), Op, Ty, getModule (), F, C.OpenedArchetypes ,
1041+ WithoutActuallyEscaping, forwardingOwnershipKind));
10341042 }
10351043
10361044 ConvertEscapeToNoEscapeInst *
@@ -1054,8 +1062,14 @@ class SILBuilder {
10541062 }
10551063
10561064 UpcastInst *createUpcast (SILLocation Loc, SILValue Op, SILType Ty) {
1065+ return createUpcast (Loc, Op, Ty, Op.getOwnershipKind ());
1066+ }
1067+
1068+ UpcastInst *createUpcast (SILLocation Loc, SILValue Op, SILType Ty,
1069+ ValueOwnershipKind forwardingOwnershipKind) {
10571070 return insert (UpcastInst::create (getSILDebugLocation (Loc), Op, Ty,
1058- getFunction (), C.OpenedArchetypes ));
1071+ getFunction (), C.OpenedArchetypes ,
1072+ forwardingOwnershipKind));
10591073 }
10601074
10611075 AddressToPointerInst *createAddressToPointer (SILLocation Loc, SILValue Op,
@@ -1075,7 +1089,16 @@ class SILBuilder {
10751089 UncheckedRefCastInst *createUncheckedRefCast (SILLocation Loc, SILValue Op,
10761090 SILType Ty) {
10771091 return insert (UncheckedRefCastInst::create (
1078- getSILDebugLocation (Loc), Op, Ty, getFunction (), C.OpenedArchetypes ));
1092+ getSILDebugLocation (Loc), Op, Ty, getFunction (), C.OpenedArchetypes ,
1093+ Op.getOwnershipKind ()));
1094+ }
1095+
1096+ UncheckedRefCastInst *
1097+ createUncheckedRefCast (SILLocation Loc, SILValue Op, SILType Ty,
1098+ ValueOwnershipKind forwardingOwnershipKind) {
1099+ return insert (UncheckedRefCastInst::create (
1100+ getSILDebugLocation (Loc), Op, Ty, getFunction (), C.OpenedArchetypes ,
1101+ forwardingOwnershipKind));
10791102 }
10801103
10811104 UncheckedRefCastAddrInst *
@@ -1107,22 +1130,41 @@ class SILBuilder {
11071130
11081131 UncheckedValueCastInst *createUncheckedValueCast (SILLocation Loc, SILValue Op,
11091132 SILType Ty) {
1133+ return createUncheckedValueCast (Loc, Op, Ty, Op.getOwnershipKind ());
1134+ }
1135+
1136+ UncheckedValueCastInst *
1137+ createUncheckedValueCast (SILLocation Loc, SILValue Op, SILType Ty,
1138+ ValueOwnershipKind forwardingOwnershipKind) {
11101139 assert (hasOwnership ());
11111140 return insert (UncheckedValueCastInst::create (
1112- getSILDebugLocation (Loc), Op, Ty, getFunction (), C.OpenedArchetypes ));
1141+ getSILDebugLocation (Loc), Op, Ty, getFunction (), C.OpenedArchetypes ,
1142+ forwardingOwnershipKind));
11131143 }
11141144
11151145 RefToBridgeObjectInst *createRefToBridgeObject (SILLocation Loc, SILValue Ref,
11161146 SILValue Bits) {
1147+ return createRefToBridgeObject (Loc, Ref, Bits, Ref.getOwnershipKind ());
1148+ }
1149+
1150+ RefToBridgeObjectInst *
1151+ createRefToBridgeObject (SILLocation Loc, SILValue Ref, SILValue Bits,
1152+ ValueOwnershipKind forwardingOwnershipKind) {
11171153 auto Ty = SILType::getBridgeObjectType (getASTContext ());
11181154 return insert (new (getModule ()) RefToBridgeObjectInst (
1119- getSILDebugLocation (Loc), Ref, Bits, Ty));
1155+ getSILDebugLocation (Loc), Ref, Bits, Ty, forwardingOwnershipKind ));
11201156 }
11211157
11221158 BridgeObjectToRefInst *createBridgeObjectToRef (SILLocation Loc, SILValue Op,
11231159 SILType Ty) {
1160+ return createBridgeObjectToRef (Loc, Op, Ty, Op.getOwnershipKind ());
1161+ }
1162+
1163+ BridgeObjectToRefInst *
1164+ createBridgeObjectToRef (SILLocation Loc, SILValue Op, SILType Ty,
1165+ ValueOwnershipKind forwardingOwnershipKind) {
11241166 return insert (new (getModule ()) BridgeObjectToRefInst (
1125- getSILDebugLocation (Loc), Op, Ty));
1167+ getSILDebugLocation (Loc), Op, Ty, forwardingOwnershipKind ));
11261168 }
11271169
11281170 ValueToBridgeObjectInst *createValueToBridgeObject (SILLocation Loc,
@@ -1158,8 +1200,15 @@ class SILBuilder {
11581200
11591201 ThinToThickFunctionInst *createThinToThickFunction (SILLocation Loc,
11601202 SILValue Op, SILType Ty) {
1203+ return createThinToThickFunction (Loc, Op, Ty, Op.getOwnershipKind ());
1204+ }
1205+
1206+ ThinToThickFunctionInst *
1207+ createThinToThickFunction (SILLocation Loc, SILValue Op, SILType Ty,
1208+ ValueOwnershipKind forwardingOwnershipKind) {
11611209 return insert (ThinToThickFunctionInst::create (
1162- getSILDebugLocation (Loc), Op, Ty, getModule (), F, C.OpenedArchetypes ));
1210+ getSILDebugLocation (Loc), Op, Ty, getModule (), F, C.OpenedArchetypes ,
1211+ forwardingOwnershipKind));
11631212 }
11641213
11651214 ThickToObjCMetatypeInst *createThickToObjCMetatype (SILLocation Loc,
@@ -1201,9 +1250,17 @@ class SILBuilder {
12011250 createUnconditionalCheckedCast (SILLocation Loc, SILValue op,
12021251 SILType destLoweredTy,
12031252 CanType destFormalTy) {
1253+ return createUnconditionalCheckedCast (Loc, op, destLoweredTy, destFormalTy,
1254+ op.getOwnershipKind ());
1255+ }
1256+
1257+ UnconditionalCheckedCastInst *
1258+ createUnconditionalCheckedCast (SILLocation Loc, SILValue op,
1259+ SILType destLoweredTy, CanType destFormalTy,
1260+ ValueOwnershipKind forwardingOwnershipKind) {
12041261 return insert (UnconditionalCheckedCastInst::create (
12051262 getSILDebugLocation (Loc), op, destLoweredTy, destFormalTy,
1206- getFunction (), C.OpenedArchetypes ));
1263+ getFunction (), C.OpenedArchetypes , forwardingOwnershipKind ));
12071264 }
12081265
12091266 UnconditionalCheckedCastAddrInst *
0 commit comments