@@ -2211,7 +2211,11 @@ enum class ParamSpecifier : uint8_t {
2211
2211
// / `__shared`, a legacy spelling of `borrowing`.
2212
2212
LegacyShared = 4 ,
2213
2213
// / `__owned`, a legacy spelling of `consuming`.
2214
- LegacyOwned = 5
2214
+ LegacyOwned = 5 ,
2215
+
2216
+ // / `transferring`. Indicating the transfer of a value from one isolation
2217
+ // / domain to another.
2218
+ Transferring = 6 ,
2215
2219
};
2216
2220
2217
2221
// / Provide parameter type relevant flags, i.e. variadic, autoclosure, and
@@ -2228,7 +2232,8 @@ class ParameterTypeFlags {
2228
2232
Isolated = 1 << 7 ,
2229
2233
CompileTimeConst = 1 << 8 ,
2230
2234
ResultDependsOn = 1 << 9 ,
2231
- NumBits = 10
2235
+ Transferring = 1 << 10 ,
2236
+ NumBits = 11
2232
2237
};
2233
2238
OptionSet<ParameterFlags> value;
2234
2239
static_assert (NumBits <= 8 *sizeof (OptionSet<ParameterFlags>), " overflowed" );
@@ -2243,20 +2248,22 @@ class ParameterTypeFlags {
2243
2248
2244
2249
ParameterTypeFlags (bool variadic, bool autoclosure, bool nonEphemeral,
2245
2250
ParamSpecifier specifier, bool isolated, bool noDerivative,
2246
- bool compileTimeConst, bool hasResultDependsOn)
2251
+ bool compileTimeConst, bool hasResultDependsOn,
2252
+ bool isTransferring)
2247
2253
: value((variadic ? Variadic : 0 ) | (autoclosure ? AutoClosure : 0 ) |
2248
2254
(nonEphemeral ? NonEphemeral : 0 ) |
2249
2255
uint8_t (specifier) << SpecifierShift | (isolated ? Isolated : 0 ) |
2250
2256
(noDerivative ? NoDerivative : 0 ) |
2251
2257
(compileTimeConst ? CompileTimeConst : 0 ) |
2252
- (hasResultDependsOn ? ResultDependsOn : 0 )) {}
2258
+ (hasResultDependsOn ? ResultDependsOn : 0 ) |
2259
+ (isTransferring ? Transferring : 0 )) {}
2253
2260
2254
2261
// / Create one from what's present in the parameter type
2255
2262
inline static ParameterTypeFlags
2256
2263
fromParameterType (Type paramTy, bool isVariadic, bool isAutoClosure,
2257
2264
bool isNonEphemeral, ParamSpecifier ownership,
2258
2265
bool isolated, bool isNoDerivative, bool compileTimeConst,
2259
- bool hasResultDependsOn);
2266
+ bool hasResultDependsOn, bool isTransferring );
2260
2267
2261
2268
bool isNone () const { return !value; }
2262
2269
bool isVariadic () const { return value.contains (Variadic); }
@@ -2269,6 +2276,7 @@ class ParameterTypeFlags {
2269
2276
bool isCompileTimeConst () const { return value.contains (CompileTimeConst); }
2270
2277
bool isNoDerivative () const { return value.contains (NoDerivative); }
2271
2278
bool hasResultDependsOn () const { return value.contains (ResultDependsOn); }
2279
+ bool isTransferring () const { return value.contains (Transferring); }
2272
2280
2273
2281
// / Get the spelling of the parameter specifier used on the parameter.
2274
2282
ParamSpecifier getOwnershipSpecifier () const {
@@ -2331,6 +2339,12 @@ class ParameterTypeFlags {
2331
2339
: value - ParameterTypeFlags::NoDerivative);
2332
2340
}
2333
2341
2342
+ ParameterTypeFlags withTransferring (bool withTransferring) const {
2343
+ return ParameterTypeFlags (withTransferring
2344
+ ? value | ParameterTypeFlags::Transferring
2345
+ : value - ParameterTypeFlags::Transferring);
2346
+ }
2347
+
2334
2348
bool operator ==(const ParameterTypeFlags &other) const {
2335
2349
return value.toRaw () == other.value .toRaw ();
2336
2350
}
@@ -2424,7 +2438,8 @@ class YieldTypeFlags {
2424
2438
/* nonEphemeral*/ false , getOwnershipSpecifier (),
2425
2439
/* isolated*/ false , /* noDerivative*/ false ,
2426
2440
/* compileTimeConst*/ false ,
2427
- /* hasResultDependsOn*/ false );
2441
+ /* hasResultDependsOn*/ false ,
2442
+ /* is transferring*/ false );
2428
2443
}
2429
2444
2430
2445
bool operator ==(const YieldTypeFlags &other) const {
@@ -4111,6 +4126,9 @@ class SILParameterInfo {
4111
4126
// / - If the function type is `@differentiable`, the function is
4112
4127
// / differentiable with respect to this parameter.
4113
4128
NotDifferentiable = 0x1 ,
4129
+
4130
+ // / Set if the given parameter is transferring.
4131
+ Transferring = 0x2 ,
4114
4132
};
4115
4133
4116
4134
using Options = OptionSet<Flag>;
@@ -7627,7 +7645,7 @@ inline TupleTypeElt TupleTypeElt::getWithType(Type T) const {
7627
7645
inline ParameterTypeFlags ParameterTypeFlags::fromParameterType (
7628
7646
Type paramTy, bool isVariadic, bool isAutoClosure, bool isNonEphemeral,
7629
7647
ParamSpecifier ownership, bool isolated, bool isNoDerivative,
7630
- bool compileTimeConst, bool hasResultDependsOn) {
7648
+ bool compileTimeConst, bool hasResultDependsOn, bool isTransferring ) {
7631
7649
// FIXME(Remove InOut): The last caller that needs this is argument
7632
7650
// decomposition. Start by enabling the assertion there and fixing up those
7633
7651
// callers, then remove this, then remove
@@ -7637,8 +7655,9 @@ inline ParameterTypeFlags ParameterTypeFlags::fromParameterType(
7637
7655
ownership == ParamSpecifier::InOut);
7638
7656
ownership = ParamSpecifier::InOut;
7639
7657
}
7640
- return {isVariadic, isAutoClosure, isNonEphemeral, ownership,
7641
- isolated, isNoDerivative, compileTimeConst, hasResultDependsOn};
7658
+ return {isVariadic, isAutoClosure, isNonEphemeral,
7659
+ ownership, isolated, isNoDerivative,
7660
+ compileTimeConst, hasResultDependsOn, isTransferring};
7642
7661
}
7643
7662
7644
7663
inline const Type *BoundGenericType::getTrailingObjectsPointer () const {
0 commit comments