@@ -2388,7 +2388,8 @@ class ParameterTypeFlags {
23882388 Isolated = 1 << 7 ,
23892389 CompileTimeConst = 1 << 8 ,
23902390 Sending = 1 << 9 ,
2391- NumBits = 10
2391+ Addressable = 1 << 10 ,
2392+ NumBits = 11
23922393 };
23932394 OptionSet<ParameterFlags> value;
23942395 static_assert (NumBits <= 8 *sizeof (OptionSet<ParameterFlags>), " overflowed" );
@@ -2403,20 +2404,21 @@ class ParameterTypeFlags {
24032404
24042405 ParameterTypeFlags (bool variadic, bool autoclosure, bool nonEphemeral,
24052406 ParamSpecifier specifier, bool isolated, bool noDerivative,
2406- bool compileTimeConst, bool isSending)
2407+ bool compileTimeConst, bool isSending, bool isAddressable )
24072408 : value((variadic ? Variadic : 0 ) | (autoclosure ? AutoClosure : 0 ) |
24082409 (nonEphemeral ? NonEphemeral : 0 ) |
24092410 uint8_t (specifier) << SpecifierShift | (isolated ? Isolated : 0 ) |
24102411 (noDerivative ? NoDerivative : 0 ) |
24112412 (compileTimeConst ? CompileTimeConst : 0 ) |
2412- (isSending ? Sending : 0 )) {}
2413+ (isSending ? Sending : 0 ) |
2414+ (isAddressable ? Addressable : 0 )) {}
24132415
24142416 // / Create one from what's present in the parameter type
24152417 inline static ParameterTypeFlags
24162418 fromParameterType (Type paramTy, bool isVariadic, bool isAutoClosure,
24172419 bool isNonEphemeral, ParamSpecifier ownership,
24182420 bool isolated, bool isNoDerivative, bool compileTimeConst,
2419- bool isSending);
2421+ bool isSending, bool isAddressable );
24202422
24212423 bool isNone () const { return !value; }
24222424 bool isVariadic () const { return value.contains (Variadic); }
@@ -2429,6 +2431,7 @@ class ParameterTypeFlags {
24292431 bool isCompileTimeConst () const { return value.contains (CompileTimeConst); }
24302432 bool isNoDerivative () const { return value.contains (NoDerivative); }
24312433 bool isSending () const { return value.contains (Sending); }
2434+ bool isAddressable () const { return value.contains (Addressable); }
24322435
24332436 // / Get the spelling of the parameter specifier used on the parameter.
24342437 ParamSpecifier getOwnershipSpecifier () const {
@@ -2497,6 +2500,12 @@ class ParameterTypeFlags {
24972500 : value - ParameterTypeFlags::Sending);
24982501 }
24992502
2503+ ParameterTypeFlags withAddressable (bool withAddressable) const {
2504+ return ParameterTypeFlags (withAddressable
2505+ ? value | ParameterTypeFlags::Addressable
2506+ : value - ParameterTypeFlags::Addressable);
2507+ }
2508+
25002509 bool operator ==(const ParameterTypeFlags &other) const {
25012510 return value.toRaw () == other.value .toRaw ();
25022511 }
@@ -2590,7 +2599,8 @@ class YieldTypeFlags {
25902599 /* nonEphemeral*/ false , getOwnershipSpecifier (),
25912600 /* isolated*/ false , /* noDerivative*/ false ,
25922601 /* compileTimeConst*/ false ,
2593- /* is sending*/ false );
2602+ /* is sending*/ false ,
2603+ /* is addressable*/ false );
25942604 }
25952605
25962606 bool operator ==(const YieldTypeFlags &other) const {
@@ -3386,6 +3396,8 @@ class AnyFunctionType : public TypeBase {
33863396
33873397 // / Whether the parameter is marked '@noDerivative'.
33883398 bool isNoDerivative () const { return Flags.isNoDerivative (); }
3399+
3400+ bool isAddressable () const { return Flags.isAddressable (); }
33893401
33903402 // / Whether the parameter might be a semantic result for autodiff purposes.
33913403 // / This includes inout parameters.
@@ -8092,7 +8104,7 @@ inline TupleTypeElt TupleTypeElt::getWithType(Type T) const {
80928104inline ParameterTypeFlags ParameterTypeFlags::fromParameterType (
80938105 Type paramTy, bool isVariadic, bool isAutoClosure, bool isNonEphemeral,
80948106 ParamSpecifier ownership, bool isolated, bool isNoDerivative,
8095- bool compileTimeConst, bool isSending) {
8107+ bool compileTimeConst, bool isSending, bool isAddressable ) {
80968108 // FIXME(Remove InOut): The last caller that needs this is argument
80978109 // decomposition. Start by enabling the assertion there and fixing up those
80988110 // callers, then remove this, then remove
@@ -8103,7 +8115,8 @@ inline ParameterTypeFlags ParameterTypeFlags::fromParameterType(
81038115 ownership = ParamSpecifier::InOut;
81048116 }
81058117 return {isVariadic, isAutoClosure, isNonEphemeral, ownership,
8106- isolated, isNoDerivative, compileTimeConst, isSending};
8118+ isolated, isNoDerivative, compileTimeConst, isSending,
8119+ isAddressable};
81078120}
81088121
81098122inline const Type *BoundGenericType::getTrailingObjectsPointer () const {
0 commit comments