Skip to content

Commit 07ff063

Browse files
committed
[AST/ASTGen/Sema/Serialization] Remove @execution attribute
Complete the transition from `@execution` to `@concurrent` and `nonisolated(nonsending)`
1 parent 54b62ae commit 07ff063

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+242
-686
lines changed

include/swift/AST/ASTBridging.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -910,15 +910,6 @@ void BridgedAvailableAttr_setIsGroupedWithWildcard(BridgedAvailableAttr cAttr);
910910
SWIFT_NAME("BridgedAvailableAttr.setIsGroupTerminator(self:)")
911911
void BridgedAvailableAttr_setIsGroupTerminator(BridgedAvailableAttr cAttr);
912912

913-
enum ENUM_EXTENSIBILITY_ATTR(closed) BridgedExecutionKind {
914-
BridgedExecutionKindCaller,
915-
};
916-
917-
SWIFT_NAME("BridgedExecutionAttr.createParsed(_:atLoc:range:behavior:)")
918-
BridgedExecutionAttr BridgedExecutionAttr_createParsed(
919-
BridgedASTContext cContext, BridgedSourceLoc atLoc,
920-
BridgedSourceRange range, BridgedExecutionKind behavior);
921-
922913
enum ENUM_EXTENSIBILITY_ATTR(closed) BridgedAccessLevel {
923914
BridgedAccessLevelPrivate,
924915
BridgedAccessLevelFilePrivate,
@@ -2596,25 +2587,13 @@ BridgedConventionTypeAttr BridgedConventionTypeAttr_createParsed(
25962587
BridgedSourceLoc cNameLoc, BridgedDeclNameRef cWitnessMethodProtocol,
25972588
BridgedStringRef cClangType, BridgedSourceLoc cClangTypeLoc);
25982589

2599-
enum ENUM_EXTENSIBILITY_ATTR(closed) BridgedExecutionTypeAttrExecutionKind {
2600-
BridgedExecutionTypeAttrExecutionKind_Caller
2601-
};
2602-
26032590
SWIFT_NAME("BridgedDifferentiableTypeAttr.createParsed(_:atLoc:nameLoc:"
26042591
"parensRange:kind:kindLoc:)")
26052592
BridgedDifferentiableTypeAttr BridgedDifferentiableTypeAttr_createParsed(
26062593
BridgedASTContext cContext, BridgedSourceLoc cAtLoc,
26072594
BridgedSourceLoc cNameLoc, BridgedSourceRange cParensRange,
26082595
BridgedDifferentiabilityKind cKind, BridgedSourceLoc cKindLoc);
26092596

2610-
SWIFT_NAME("BridgedExecutionTypeAttr.createParsed(_:atLoc:nameLoc:parensRange:"
2611-
"behavior:behaviorLoc:)")
2612-
BridgedExecutionTypeAttr BridgedExecutionTypeAttr_createParsed(
2613-
BridgedASTContext cContext, BridgedSourceLoc cAtLoc,
2614-
BridgedSourceLoc cNameLoc, BridgedSourceRange cParensRange,
2615-
BridgedExecutionTypeAttrExecutionKind behavior,
2616-
BridgedSourceLoc cBehaviorLoc);
2617-
26182597
SWIFT_NAME("BridgedIsolatedTypeAttr.createParsed(_:atLoc:nameLoc:parensRange:"
26192598
"isolationKind:isolationKindLoc:)")
26202599
BridgedIsolatedTypeAttr BridgedIsolatedTypeAttr_createParsed(

include/swift/AST/Attr.h

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,6 @@ class DeclAttribute : public AttributeBase {
236236

237237
NumFeatures : 31
238238
);
239-
240-
SWIFT_INLINE_BITFIELD(ExecutionAttr, DeclAttribute, NumExecutionKindBits,
241-
Behavior : NumExecutionKindBits
242-
);
243239
} Bits;
244240
// clang-format on
245241

@@ -3284,34 +3280,6 @@ class ABIAttr : public DeclAttribute {
32843280
}
32853281
};
32863282

3287-
class ExecutionAttr : public DeclAttribute {
3288-
public:
3289-
ExecutionAttr(SourceLoc AtLoc, SourceRange Range,
3290-
ExecutionKind behavior,
3291-
bool Implicit)
3292-
: DeclAttribute(DeclAttrKind::Execution, AtLoc, Range, Implicit) {
3293-
Bits.ExecutionAttr.Behavior = static_cast<uint8_t>(behavior);
3294-
}
3295-
3296-
ExecutionAttr(ExecutionKind behavior, bool Implicit)
3297-
: ExecutionAttr(/*AtLoc=*/SourceLoc(), /*Range=*/SourceRange(), behavior,
3298-
Implicit) {}
3299-
3300-
ExecutionKind getBehavior() const {
3301-
return static_cast<ExecutionKind>(Bits.ExecutionAttr.Behavior);
3302-
}
3303-
3304-
static bool classof(const DeclAttribute *DA) {
3305-
return DA->getKind() == DeclAttrKind::Execution;
3306-
}
3307-
3308-
UNIMPLEMENTED_CLONE(ExecutionAttr)
3309-
3310-
bool isEquivalent(const ExecutionAttr *other, Decl *attachedTo) const {
3311-
return getBehavior() == other->getBehavior();
3312-
}
3313-
};
3314-
33153283
/// Attributes that may be applied to declarations.
33163284
class DeclAttributes {
33173285
/// Linked list of declaration attributes.
@@ -3771,10 +3739,6 @@ class alignas(1 << AttrAlignInBits) TypeAttribute
37713739
SWIFT_INLINE_BITFIELD_FULL(IsolatedTypeAttr, TypeAttribute, 8,
37723740
Kind : 8
37733741
);
3774-
3775-
SWIFT_INLINE_BITFIELD_FULL(ExecutionTypeAttr, TypeAttribute, 8,
3776-
Behavior : 8
3777-
);
37783742
} Bits;
37793743
// clang-format on
37803744

@@ -4046,28 +4010,6 @@ class IsolatedTypeAttr : public SimpleTypeAttrWithArgs<TypeAttrKind::Isolated> {
40464010
void printImpl(ASTPrinter &printer, const PrintOptions &options) const;
40474011
};
40484012

4049-
/// The @execution function type attribute.
4050-
class ExecutionTypeAttr : public SimpleTypeAttrWithArgs<TypeAttrKind::Execution> {
4051-
SourceLoc BehaviorLoc;
4052-
4053-
public:
4054-
ExecutionTypeAttr(SourceLoc atLoc, SourceLoc kwLoc, SourceRange parensRange,
4055-
Located<ExecutionKind> behavior)
4056-
: SimpleTypeAttr(atLoc, kwLoc, parensRange), BehaviorLoc(behavior.Loc) {
4057-
Bits.ExecutionTypeAttr.Behavior = uint8_t(behavior.Item);
4058-
}
4059-
4060-
ExecutionKind getBehavior() const {
4061-
return ExecutionKind(Bits.ExecutionTypeAttr.Behavior);
4062-
}
4063-
4064-
SourceLoc getBehaviorLoc() const {
4065-
return BehaviorLoc;
4066-
}
4067-
4068-
void printImpl(ASTPrinter &printer, const PrintOptions &options) const;
4069-
};
4070-
40714013
using TypeOrCustomAttr =
40724014
llvm::PointerUnion<CustomAttr*, TypeAttribute*>;
40734015

include/swift/AST/AttrKind.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,6 @@ enum class ExternKind: uint8_t {
130130
enum : unsigned { NumExternKindBits =
131131
countBitsUsed(static_cast<unsigned>(ExternKind::Last_ExternKind)) };
132132

133-
enum class ExecutionKind : uint8_t {
134-
Caller = 0,
135-
Last_ExecutionKind = Caller
136-
};
137-
138-
enum : unsigned { NumExecutionKindBits =
139-
countBitsUsed(static_cast<unsigned>(ExecutionKind::Last_ExecutionKind)) };
140-
141133
enum class NonIsolatedModifier : uint8_t {
142134
None = 0,
143135
Unsafe,

include/swift/AST/Decl.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8146,8 +8146,6 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
81468146
return cast_or_null<AbstractFunctionDecl>(ValueDecl::getOverriddenDecl());
81478147
}
81488148

8149-
std::optional<ExecutionKind> getExecutionBehavior() const;
8150-
81518149
/// Whether the declaration is later overridden in the module
81528150
///
81538151
/// Overrides are resolved during type checking; only query this field after

include/swift/AST/DeclAttr.def

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -862,11 +862,7 @@ DECL_ATTR(abi, ABI,
862862
165)
863863
DECL_ATTR_FEATURE_REQUIREMENT(ABI, ABIAttribute)
864864

865-
DECL_ATTR(execution, Execution,
866-
OnFunc | OnConstructor | OnSubscript | OnVar,
867-
ABIBreakingToAdd | ABIBreakingToRemove | APIBreakingToAdd | APIBreakingToRemove | UnconstrainedInABIAttr,
868-
166)
869-
DECL_ATTR_FEATURE_REQUIREMENT(Execution, ExecutionAttribute)
865+
// Unused '166': Used to be `@execution(caller | concurrent)` replaced with `@concurrent` and `nonisolated(nonsending)`
870866

871867
SIMPLE_DECL_ATTR(const, ConstVal,
872868
OnParam | OnVar | OnFunc,

include/swift/AST/DiagnosticsParse.def

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1700,14 +1700,6 @@ ERROR(attr_isolated_expected_rparen,none,
17001700
ERROR(attr_isolated_expected_kind,none,
17011701
"expected 'any' as the isolation kind", ())
17021702

1703-
ERROR(attr_execution_expected_lparen,none,
1704-
"expected '(' after '@execution'",
1705-
())
1706-
ERROR(attr_execution_expected_rparen,none,
1707-
"expected ')' after execution behavior", ())
1708-
ERROR(attr_execution_expected_kind,none,
1709-
"expected 'concurrent' or 'caller' as the execution behavior", ())
1710-
17111703
ERROR(attr_private_import_expected_rparen,none,
17121704
"expected ')' after function name for @_private", ())
17131705
ERROR(attr_private_import_expected_sourcefile, none,

include/swift/AST/DiagnosticsSema.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8550,7 +8550,7 @@ GROUPED_ERROR(isolated_conformance_wrong_domain,IsolatedConformances,none,
85508550
(ActorIsolation, Type, DeclName, ActorIsolation))
85518551
85528552
//===----------------------------------------------------------------------===//
8553-
// MARK: @execution, @concurrent and nonisolated(nonsending) attributes
8553+
// MARK: @concurrent and nonisolated(nonsending) attributes
85548554
//===----------------------------------------------------------------------===//
85558555
85568556
ERROR(execution_behavior_only_on_async,none,

include/swift/AST/TypeAttr.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ TYPE_ATTR(_opaqueReturnTypeOf, OpaqueReturnTypeOf)
6767
TYPE_ATTR(isolated, Isolated)
6868
SIMPLE_TYPE_ATTR(nonisolated, Nonisolated)
6969
SIMPLE_TYPE_ATTR(_addressable, Addressable)
70-
TYPE_ATTR(execution, Execution)
7170
SIMPLE_TYPE_ATTR(concurrent, Concurrent)
7271

7372
// SIL-specific attributes

lib/AST/ASTDumper.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -618,12 +618,6 @@ static StringRef getDumpString(FunctionRefInfo::ApplyLevel applyLevel) {
618618
return "double_apply";
619619
}
620620
}
621-
static StringRef getDumpString(ExecutionKind kind) {
622-
switch (kind) {
623-
case ExecutionKind::Caller:
624-
return "caller";
625-
}
626-
}
627621
static StringRef getDumpString(ExplicitSafety safety) {
628622
switch (safety) {
629623
case ExplicitSafety::Unspecified:
@@ -4936,11 +4930,6 @@ class PrintAttribute : public AttributeVisitor<PrintAttribute, void, Label>,
49364930

49374931
#undef TRIVIAL_ATTR_PRINTER
49384932

4939-
void visitExecutionAttr(ExecutionAttr *Attr, Label label) {
4940-
printCommon(Attr, "execution_attr", label);
4941-
printField(Attr->getBehavior(), Label::always("behavior"));
4942-
printFoot();
4943-
}
49444933
void visitABIAttr(ABIAttr *Attr, Label label) {
49454934
printCommon(Attr, "abi_attr", label);
49464935
printRec(Attr->abiDecl, Label::always("decl"));
@@ -6349,7 +6338,7 @@ namespace {
63496338
printFlag("@isolated(any)");
63506339
break;
63516340
case FunctionTypeIsolation::Kind::NonIsolatedCaller:
6352-
printFlag("@execution(caller)");
6341+
printFlag("nonisolated(nonsending)");
63536342
break;
63546343
}
63556344
}

lib/AST/ASTPrinter.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3306,7 +3306,7 @@ static void
33063306
suppressingFeatureExecutionAttribute(PrintOptions &options,
33073307
llvm::function_ref<void()> action) {
33083308
llvm::SaveAndRestore<bool> scope1(options.SuppressExecutionAttribute, true);
3309-
ExcludeAttrRAII scope2(options.ExcludeAttrList, DeclAttrKind::Execution);
3309+
ExcludeAttrRAII scope2(options.ExcludeAttrList, DeclAttrKind::Concurrent);
33103310
action();
33113311
}
33123312

@@ -6509,8 +6509,7 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
65096509
break;
65106510

65116511
case FunctionTypeIsolation::Kind::NonIsolatedCaller:
6512-
if (!Options.SuppressExecutionAttribute)
6513-
Printer << "@execution(caller) ";
6512+
Printer << "nonisolated(nonsending) ";
65146513
break;
65156514
}
65166515

0 commit comments

Comments
 (0)