@@ -2211,7 +2211,11 @@ enum class ParamSpecifier : uint8_t {
22112211 // / `__shared`, a legacy spelling of `borrowing`.
22122212 LegacyShared = 4 ,
22132213 // / `__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 ,
22152219};
22162220
22172221// / Provide parameter type relevant flags, i.e. variadic, autoclosure, and
@@ -2228,7 +2232,8 @@ class ParameterTypeFlags {
22282232 Isolated = 1 << 7 ,
22292233 CompileTimeConst = 1 << 8 ,
22302234 ResultDependsOn = 1 << 9 ,
2231- NumBits = 10
2235+ Transferring = 1 << 10 ,
2236+ NumBits = 11
22322237 };
22332238 OptionSet<ParameterFlags> value;
22342239 static_assert (NumBits <= 8 *sizeof (OptionSet<ParameterFlags>), " overflowed" );
@@ -2243,20 +2248,22 @@ class ParameterTypeFlags {
22432248
22442249 ParameterTypeFlags (bool variadic, bool autoclosure, bool nonEphemeral,
22452250 ParamSpecifier specifier, bool isolated, bool noDerivative,
2246- bool compileTimeConst, bool hasResultDependsOn)
2251+ bool compileTimeConst, bool hasResultDependsOn,
2252+ bool isTransferring)
22472253 : value((variadic ? Variadic : 0 ) | (autoclosure ? AutoClosure : 0 ) |
22482254 (nonEphemeral ? NonEphemeral : 0 ) |
22492255 uint8_t (specifier) << SpecifierShift | (isolated ? Isolated : 0 ) |
22502256 (noDerivative ? NoDerivative : 0 ) |
22512257 (compileTimeConst ? CompileTimeConst : 0 ) |
2252- (hasResultDependsOn ? ResultDependsOn : 0 )) {}
2258+ (hasResultDependsOn ? ResultDependsOn : 0 ) |
2259+ (isTransferring ? Transferring : 0 )) {}
22532260
22542261 // / Create one from what's present in the parameter type
22552262 inline static ParameterTypeFlags
22562263 fromParameterType (Type paramTy, bool isVariadic, bool isAutoClosure,
22572264 bool isNonEphemeral, ParamSpecifier ownership,
22582265 bool isolated, bool isNoDerivative, bool compileTimeConst,
2259- bool hasResultDependsOn);
2266+ bool hasResultDependsOn, bool isTransferring );
22602267
22612268 bool isNone () const { return !value; }
22622269 bool isVariadic () const { return value.contains (Variadic); }
@@ -2269,6 +2276,7 @@ class ParameterTypeFlags {
22692276 bool isCompileTimeConst () const { return value.contains (CompileTimeConst); }
22702277 bool isNoDerivative () const { return value.contains (NoDerivative); }
22712278 bool hasResultDependsOn () const { return value.contains (ResultDependsOn); }
2279+ bool isTransferring () const { return value.contains (Transferring); }
22722280
22732281 // / Get the spelling of the parameter specifier used on the parameter.
22742282 ParamSpecifier getOwnershipSpecifier () const {
@@ -2331,6 +2339,12 @@ class ParameterTypeFlags {
23312339 : value - ParameterTypeFlags::NoDerivative);
23322340 }
23332341
2342+ ParameterTypeFlags withTransferring (bool withTransferring) const {
2343+ return ParameterTypeFlags (withTransferring
2344+ ? value | ParameterTypeFlags::Transferring
2345+ : value - ParameterTypeFlags::Transferring);
2346+ }
2347+
23342348 bool operator ==(const ParameterTypeFlags &other) const {
23352349 return value.toRaw () == other.value .toRaw ();
23362350 }
@@ -2424,7 +2438,8 @@ class YieldTypeFlags {
24242438 /* nonEphemeral*/ false , getOwnershipSpecifier (),
24252439 /* isolated*/ false , /* noDerivative*/ false ,
24262440 /* compileTimeConst*/ false ,
2427- /* hasResultDependsOn*/ false );
2441+ /* hasResultDependsOn*/ false ,
2442+ /* is transferring*/ false );
24282443 }
24292444
24302445 bool operator ==(const YieldTypeFlags &other) const {
@@ -4111,6 +4126,9 @@ class SILParameterInfo {
41114126 // / - If the function type is `@differentiable`, the function is
41124127 // / differentiable with respect to this parameter.
41134128 NotDifferentiable = 0x1 ,
4129+
4130+ // / Set if the given parameter is transferring.
4131+ Transferring = 0x2 ,
41144132 };
41154133
41164134 using Options = OptionSet<Flag>;
@@ -7627,7 +7645,7 @@ inline TupleTypeElt TupleTypeElt::getWithType(Type T) const {
76277645inline ParameterTypeFlags ParameterTypeFlags::fromParameterType (
76287646 Type paramTy, bool isVariadic, bool isAutoClosure, bool isNonEphemeral,
76297647 ParamSpecifier ownership, bool isolated, bool isNoDerivative,
7630- bool compileTimeConst, bool hasResultDependsOn) {
7648+ bool compileTimeConst, bool hasResultDependsOn, bool isTransferring ) {
76317649 // FIXME(Remove InOut): The last caller that needs this is argument
76327650 // decomposition. Start by enabling the assertion there and fixing up those
76337651 // callers, then remove this, then remove
@@ -7637,8 +7655,9 @@ inline ParameterTypeFlags ParameterTypeFlags::fromParameterType(
76377655 ownership == ParamSpecifier::InOut);
76387656 ownership = ParamSpecifier::InOut;
76397657 }
7640- return {isVariadic, isAutoClosure, isNonEphemeral, ownership,
7641- isolated, isNoDerivative, compileTimeConst, hasResultDependsOn};
7658+ return {isVariadic, isAutoClosure, isNonEphemeral,
7659+ ownership, isolated, isNoDerivative,
7660+ compileTimeConst, hasResultDependsOn, isTransferring};
76427661}
76437662
76447663inline const Type *BoundGenericType::getTrailingObjectsPointer () const {
0 commit comments