@@ -226,8 +226,8 @@ class DeclAttribute : public AttributeBase {
226
226
isEarlyAdopter : 1
227
227
);
228
228
229
- SWIFT_INLINE_BITFIELD (NonisolatedAttr, DeclAttribute, 1 ,
230
- isUnsafe : 1
229
+ SWIFT_INLINE_BITFIELD (NonisolatedAttr, DeclAttribute, NumNonIsolatedModifierBits ,
230
+ Modifier : NumNonIsolatedModifierBits
231
231
);
232
232
233
233
SWIFT_INLINE_BITFIELD_FULL (AllowFeatureSuppressionAttr, DeclAttribute, 1 +31 ,
@@ -236,10 +236,6 @@ class DeclAttribute : public AttributeBase {
236
236
237
237
NumFeatures : 31
238
238
);
239
-
240
- SWIFT_INLINE_BITFIELD (ExecutionAttr, DeclAttribute, NumExecutionKindBits,
241
- Behavior : NumExecutionKindBits
242
- );
243
239
} Bits;
244
240
// clang-format on
245
241
@@ -2978,29 +2974,40 @@ class ObjCImplementationAttr final : public DeclAttribute {
2978
2974
// / Represents nonisolated modifier.
2979
2975
class NonisolatedAttr final : public DeclAttribute {
2980
2976
public:
2981
- NonisolatedAttr (SourceLoc atLoc, SourceRange range, bool unsafe,
2982
- bool implicit)
2977
+ NonisolatedAttr (SourceLoc atLoc, SourceRange range,
2978
+ NonIsolatedModifier modifier, bool implicit)
2983
2979
: DeclAttribute(DeclAttrKind::Nonisolated, atLoc, range, implicit) {
2984
- Bits.NonisolatedAttr .isUnsafe = unsafe ;
2985
- assert ((isUnsafe () == unsafe ) && " not enough bits for unsafe state " );
2980
+ Bits.NonisolatedAttr .Modifier = static_cast < unsigned >(modifier) ;
2981
+ assert ((getModifier () == modifier ) && " not enough bits for modifier " );
2986
2982
}
2987
2983
2988
- NonisolatedAttr (bool unsafe, bool implicit)
2989
- : NonisolatedAttr({}, {}, unsafe, implicit) {}
2984
+ NonIsolatedModifier getModifier () const {
2985
+ return static_cast <NonIsolatedModifier>(Bits.NonisolatedAttr .Modifier );
2986
+ }
2990
2987
2991
- bool isUnsafe () const { return Bits.NonisolatedAttr .isUnsafe ; }
2988
+ bool isUnsafe () const { return getModifier () == NonIsolatedModifier::Unsafe; }
2989
+ bool isNonSending () const {
2990
+ return getModifier () == NonIsolatedModifier::NonSending;
2991
+ }
2992
+
2993
+ static NonisolatedAttr *
2994
+ createImplicit (ASTContext &ctx,
2995
+ NonIsolatedModifier modifier = NonIsolatedModifier::None) {
2996
+ return new (ctx) NonisolatedAttr (/* atLoc*/ {}, /* range*/ {}, modifier,
2997
+ /* implicit=*/ true );
2998
+ }
2992
2999
2993
3000
static bool classof (const DeclAttribute *DA) {
2994
3001
return DA->getKind () == DeclAttrKind::Nonisolated;
2995
3002
}
2996
3003
2997
3004
// / Create a copy of this attribute.
2998
3005
NonisolatedAttr *clone (ASTContext &ctx) const {
2999
- return new (ctx) NonisolatedAttr (AtLoc, Range, isUnsafe (), isImplicit ());
3006
+ return new (ctx) NonisolatedAttr (AtLoc, Range, getModifier (), isImplicit ());
3000
3007
}
3001
3008
3002
3009
bool isEquivalent (const NonisolatedAttr *other, Decl *attachedTo) const {
3003
- return isUnsafe () == other->isUnsafe ();
3010
+ return getModifier () == other->getModifier ();
3004
3011
}
3005
3012
};
3006
3013
@@ -3275,34 +3282,6 @@ class ABIAttr : public DeclAttribute {
3275
3282
}
3276
3283
};
3277
3284
3278
- class ExecutionAttr : public DeclAttribute {
3279
- public:
3280
- ExecutionAttr (SourceLoc AtLoc, SourceRange Range,
3281
- ExecutionKind behavior,
3282
- bool Implicit)
3283
- : DeclAttribute(DeclAttrKind::Execution, AtLoc, Range, Implicit) {
3284
- Bits.ExecutionAttr .Behavior = static_cast <uint8_t >(behavior);
3285
- }
3286
-
3287
- ExecutionAttr (ExecutionKind behavior, bool Implicit)
3288
- : ExecutionAttr(/* AtLoc=*/ SourceLoc(), /* Range=*/ SourceRange(), behavior,
3289
- Implicit) {}
3290
-
3291
- ExecutionKind getBehavior () const {
3292
- return static_cast <ExecutionKind>(Bits.ExecutionAttr .Behavior );
3293
- }
3294
-
3295
- static bool classof (const DeclAttribute *DA) {
3296
- return DA->getKind () == DeclAttrKind::Execution;
3297
- }
3298
-
3299
- UNIMPLEMENTED_CLONE (ExecutionAttr)
3300
-
3301
- bool isEquivalent (const ExecutionAttr *other, Decl *attachedTo) const {
3302
- return getBehavior () == other->getBehavior ();
3303
- }
3304
- };
3305
-
3306
3285
// / Attributes that may be applied to declarations.
3307
3286
class DeclAttributes {
3308
3287
// / Linked list of declaration attributes.
@@ -3762,10 +3741,6 @@ class alignas(1 << AttrAlignInBits) TypeAttribute
3762
3741
SWIFT_INLINE_BITFIELD_FULL (IsolatedTypeAttr, TypeAttribute, 8 ,
3763
3742
Kind : 8
3764
3743
);
3765
-
3766
- SWIFT_INLINE_BITFIELD_FULL (ExecutionTypeAttr, TypeAttribute, 8 ,
3767
- Behavior : 8
3768
- );
3769
3744
} Bits;
3770
3745
// clang-format on
3771
3746
@@ -4037,28 +4012,6 @@ class IsolatedTypeAttr : public SimpleTypeAttrWithArgs<TypeAttrKind::Isolated> {
4037
4012
void printImpl (ASTPrinter &printer, const PrintOptions &options) const ;
4038
4013
};
4039
4014
4040
- // / The @execution function type attribute.
4041
- class ExecutionTypeAttr : public SimpleTypeAttrWithArgs <TypeAttrKind::Execution> {
4042
- SourceLoc BehaviorLoc;
4043
-
4044
- public:
4045
- ExecutionTypeAttr (SourceLoc atLoc, SourceLoc kwLoc, SourceRange parensRange,
4046
- Located<ExecutionKind> behavior)
4047
- : SimpleTypeAttr(atLoc, kwLoc, parensRange), BehaviorLoc(behavior.Loc) {
4048
- Bits.ExecutionTypeAttr .Behavior = uint8_t (behavior.Item );
4049
- }
4050
-
4051
- ExecutionKind getBehavior () const {
4052
- return ExecutionKind (Bits.ExecutionTypeAttr .Behavior );
4053
- }
4054
-
4055
- SourceLoc getBehaviorLoc () const {
4056
- return BehaviorLoc;
4057
- }
4058
-
4059
- void printImpl (ASTPrinter &printer, const PrintOptions &options) const ;
4060
- };
4061
-
4062
4015
using TypeOrCustomAttr =
4063
4016
llvm::PointerUnion<CustomAttr*, TypeAttribute*>;
4064
4017
0 commit comments