@@ -1028,9 +1028,17 @@ class SILBuilder {
1028
1028
ConvertFunctionInst *createConvertFunction (SILLocation Loc, SILValue Op,
1029
1029
SILType Ty,
1030
1030
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));
1034
1042
}
1035
1043
1036
1044
ConvertEscapeToNoEscapeInst *
@@ -1054,8 +1062,14 @@ class SILBuilder {
1054
1062
}
1055
1063
1056
1064
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) {
1057
1070
return insert (UpcastInst::create (getSILDebugLocation (Loc), Op, Ty,
1058
- getFunction (), C.OpenedArchetypes ));
1071
+ getFunction (), C.OpenedArchetypes ,
1072
+ forwardingOwnershipKind));
1059
1073
}
1060
1074
1061
1075
AddressToPointerInst *createAddressToPointer (SILLocation Loc, SILValue Op,
@@ -1075,7 +1089,16 @@ class SILBuilder {
1075
1089
UncheckedRefCastInst *createUncheckedRefCast (SILLocation Loc, SILValue Op,
1076
1090
SILType Ty) {
1077
1091
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));
1079
1102
}
1080
1103
1081
1104
UncheckedRefCastAddrInst *
@@ -1107,22 +1130,41 @@ class SILBuilder {
1107
1130
1108
1131
UncheckedValueCastInst *createUncheckedValueCast (SILLocation Loc, SILValue Op,
1109
1132
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) {
1110
1139
assert (hasOwnership ());
1111
1140
return insert (UncheckedValueCastInst::create (
1112
- getSILDebugLocation (Loc), Op, Ty, getFunction (), C.OpenedArchetypes ));
1141
+ getSILDebugLocation (Loc), Op, Ty, getFunction (), C.OpenedArchetypes ,
1142
+ forwardingOwnershipKind));
1113
1143
}
1114
1144
1115
1145
RefToBridgeObjectInst *createRefToBridgeObject (SILLocation Loc, SILValue Ref,
1116
1146
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) {
1117
1153
auto Ty = SILType::getBridgeObjectType (getASTContext ());
1118
1154
return insert (new (getModule ()) RefToBridgeObjectInst (
1119
- getSILDebugLocation (Loc), Ref, Bits, Ty));
1155
+ getSILDebugLocation (Loc), Ref, Bits, Ty, forwardingOwnershipKind ));
1120
1156
}
1121
1157
1122
1158
BridgeObjectToRefInst *createBridgeObjectToRef (SILLocation Loc, SILValue Op,
1123
1159
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) {
1124
1166
return insert (new (getModule ()) BridgeObjectToRefInst (
1125
- getSILDebugLocation (Loc), Op, Ty));
1167
+ getSILDebugLocation (Loc), Op, Ty, forwardingOwnershipKind ));
1126
1168
}
1127
1169
1128
1170
ValueToBridgeObjectInst *createValueToBridgeObject (SILLocation Loc,
@@ -1158,8 +1200,15 @@ class SILBuilder {
1158
1200
1159
1201
ThinToThickFunctionInst *createThinToThickFunction (SILLocation Loc,
1160
1202
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) {
1161
1209
return insert (ThinToThickFunctionInst::create (
1162
- getSILDebugLocation (Loc), Op, Ty, getModule (), F, C.OpenedArchetypes ));
1210
+ getSILDebugLocation (Loc), Op, Ty, getModule (), F, C.OpenedArchetypes ,
1211
+ forwardingOwnershipKind));
1163
1212
}
1164
1213
1165
1214
ThickToObjCMetatypeInst *createThickToObjCMetatype (SILLocation Loc,
@@ -1201,9 +1250,17 @@ class SILBuilder {
1201
1250
createUnconditionalCheckedCast (SILLocation Loc, SILValue op,
1202
1251
SILType destLoweredTy,
1203
1252
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) {
1204
1261
return insert (UnconditionalCheckedCastInst::create (
1205
1262
getSILDebugLocation (Loc), op, destLoweredTy, destFormalTy,
1206
- getFunction (), C.OpenedArchetypes ));
1263
+ getFunction (), C.OpenedArchetypes , forwardingOwnershipKind ));
1207
1264
}
1208
1265
1209
1266
UnconditionalCheckedCastAddrInst *
0 commit comments