@@ -2388,7 +2388,8 @@ class ParameterTypeFlags {
2388
2388
Isolated = 1 << 7 ,
2389
2389
CompileTimeConst = 1 << 8 ,
2390
2390
Sending = 1 << 9 ,
2391
- NumBits = 10
2391
+ Addressable = 1 << 10 ,
2392
+ NumBits = 11
2392
2393
};
2393
2394
OptionSet<ParameterFlags> value;
2394
2395
static_assert (NumBits <= 8 *sizeof (OptionSet<ParameterFlags>), " overflowed" );
@@ -2403,20 +2404,21 @@ class ParameterTypeFlags {
2403
2404
2404
2405
ParameterTypeFlags (bool variadic, bool autoclosure, bool nonEphemeral,
2405
2406
ParamSpecifier specifier, bool isolated, bool noDerivative,
2406
- bool compileTimeConst, bool isSending)
2407
+ bool compileTimeConst, bool isSending, bool isAddressable )
2407
2408
: value((variadic ? Variadic : 0 ) | (autoclosure ? AutoClosure : 0 ) |
2408
2409
(nonEphemeral ? NonEphemeral : 0 ) |
2409
2410
uint8_t (specifier) << SpecifierShift | (isolated ? Isolated : 0 ) |
2410
2411
(noDerivative ? NoDerivative : 0 ) |
2411
2412
(compileTimeConst ? CompileTimeConst : 0 ) |
2412
- (isSending ? Sending : 0 )) {}
2413
+ (isSending ? Sending : 0 ) |
2414
+ (isAddressable ? Addressable : 0 )) {}
2413
2415
2414
2416
// / Create one from what's present in the parameter type
2415
2417
inline static ParameterTypeFlags
2416
2418
fromParameterType (Type paramTy, bool isVariadic, bool isAutoClosure,
2417
2419
bool isNonEphemeral, ParamSpecifier ownership,
2418
2420
bool isolated, bool isNoDerivative, bool compileTimeConst,
2419
- bool isSending);
2421
+ bool isSending, bool isAddressable );
2420
2422
2421
2423
bool isNone () const { return !value; }
2422
2424
bool isVariadic () const { return value.contains (Variadic); }
@@ -2429,6 +2431,7 @@ class ParameterTypeFlags {
2429
2431
bool isCompileTimeConst () const { return value.contains (CompileTimeConst); }
2430
2432
bool isNoDerivative () const { return value.contains (NoDerivative); }
2431
2433
bool isSending () const { return value.contains (Sending); }
2434
+ bool isAddressable () const { return value.contains (Addressable); }
2432
2435
2433
2436
// / Get the spelling of the parameter specifier used on the parameter.
2434
2437
ParamSpecifier getOwnershipSpecifier () const {
@@ -2497,6 +2500,12 @@ class ParameterTypeFlags {
2497
2500
: value - ParameterTypeFlags::Sending);
2498
2501
}
2499
2502
2503
+ ParameterTypeFlags withAddressable (bool withAddressable) const {
2504
+ return ParameterTypeFlags (withAddressable
2505
+ ? value | ParameterTypeFlags::Addressable
2506
+ : value - ParameterTypeFlags::Addressable);
2507
+ }
2508
+
2500
2509
bool operator ==(const ParameterTypeFlags &other) const {
2501
2510
return value.toRaw () == other.value .toRaw ();
2502
2511
}
@@ -2590,7 +2599,8 @@ class YieldTypeFlags {
2590
2599
/* nonEphemeral*/ false , getOwnershipSpecifier (),
2591
2600
/* isolated*/ false , /* noDerivative*/ false ,
2592
2601
/* compileTimeConst*/ false ,
2593
- /* is sending*/ false );
2602
+ /* is sending*/ false ,
2603
+ /* is addressable*/ false );
2594
2604
}
2595
2605
2596
2606
bool operator ==(const YieldTypeFlags &other) const {
@@ -3386,6 +3396,8 @@ class AnyFunctionType : public TypeBase {
3386
3396
3387
3397
// / Whether the parameter is marked '@noDerivative'.
3388
3398
bool isNoDerivative () const { return Flags.isNoDerivative (); }
3399
+
3400
+ bool isAddressable () const { return Flags.isAddressable (); }
3389
3401
3390
3402
// / Whether the parameter might be a semantic result for autodiff purposes.
3391
3403
// / This includes inout parameters.
@@ -8092,7 +8104,7 @@ inline TupleTypeElt TupleTypeElt::getWithType(Type T) const {
8092
8104
inline ParameterTypeFlags ParameterTypeFlags::fromParameterType (
8093
8105
Type paramTy, bool isVariadic, bool isAutoClosure, bool isNonEphemeral,
8094
8106
ParamSpecifier ownership, bool isolated, bool isNoDerivative,
8095
- bool compileTimeConst, bool isSending) {
8107
+ bool compileTimeConst, bool isSending, bool isAddressable ) {
8096
8108
// FIXME(Remove InOut): The last caller that needs this is argument
8097
8109
// decomposition. Start by enabling the assertion there and fixing up those
8098
8110
// callers, then remove this, then remove
@@ -8103,7 +8115,8 @@ inline ParameterTypeFlags ParameterTypeFlags::fromParameterType(
8103
8115
ownership = ParamSpecifier::InOut;
8104
8116
}
8105
8117
return {isVariadic, isAutoClosure, isNonEphemeral, ownership,
8106
- isolated, isNoDerivative, compileTimeConst, isSending};
8118
+ isolated, isNoDerivative, compileTimeConst, isSending,
8119
+ isAddressable};
8107
8120
}
8108
8121
8109
8122
inline const Type *BoundGenericType::getTrailingObjectsPointer () const {
0 commit comments