Skip to content

Commit 52096a6

Browse files
committed
SE-0302: Rename ConcurrentValue/@Concurrent to Sendable/@sendable.
1 parent 508274c commit 52096a6

File tree

66 files changed

+280
-254
lines changed

Some content is hidden

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

66 files changed

+280
-254
lines changed

docs/ABI/Mangling.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -567,14 +567,14 @@ Types
567567
C-TYPE is mangled according to the Itanium ABI, and prefixed with the length.
568568
Non-ASCII identifiers are preserved as-is; we do not use Punycode.
569569

570-
function-signature ::= params-type params-type async? concurrent? throws? // results and parameters
570+
function-signature ::= params-type params-type async? sendable? throws? // results and parameters
571571

572572
params-type ::= type 'z'? 'h'? // tuple in case of multiple parameters or a single parameter with a single tuple type
573573
// with optional inout convention, shared convention. parameters don't have labels,
574574
// they are mangled separately as part of the entity.
575575
params-type ::= empty-list // shortcut for no parameters
576576

577-
concurrent ::= 'J' // @concurrent on function types
577+
sendable ::= 'J' // @Sendable on function types
578578
async ::= 'Y' // 'async' annotation on function types
579579
throws ::= 'K' // 'throws' annotation on function types
580580

@@ -636,7 +636,7 @@ mangled in to disambiguate.
636636
impl-function-type ::= type* 'I' FUNC-ATTRIBUTES '_'
637637
impl-function-type ::= type* generic-signature 'I' FUNC-ATTRIBUTES '_'
638638

639-
FUNC-ATTRIBUTES ::= PATTERN-SUBS? INVOCATION-SUBS? PSEUDO-GENERIC? CALLEE-ESCAPE? DIFFERENTIABILITY-KIND? CALLEE-CONVENTION FUNC-REPRESENTATION? COROUTINE-KIND? CONCURRENT? ASYNC? (PARAM-CONVENTION PARAM-DIFFERENTIABILITY?)* RESULT-CONVENTION* ('Y' PARAM-CONVENTION)* ('z' RESULT-CONVENTION RESULT-DIFFERENTIABILITY?)?
639+
FUNC-ATTRIBUTES ::= PATTERN-SUBS? INVOCATION-SUBS? PSEUDO-GENERIC? CALLEE-ESCAPE? DIFFERENTIABILITY-KIND? CALLEE-CONVENTION FUNC-REPRESENTATION? COROUTINE-KIND? SENDABLE? ASYNC? (PARAM-CONVENTION PARAM-DIFFERENTIABILITY?)* RESULT-CONVENTION* ('Y' PARAM-CONVENTION)* ('z' RESULT-CONVENTION RESULT-DIFFERENTIABILITY?)?
640640

641641
PATTERN-SUBS ::= 's' // has pattern substitutions
642642
INVOCATION-SUB ::= 'I' // has invocation substitutions
@@ -666,7 +666,7 @@ mangled in to disambiguate.
666666
COROUTINE-KIND ::= 'A' // yield-once coroutine
667667
COROUTINE-KIND ::= 'G' // yield-many coroutine
668668

669-
CONCURRENT ::= 'h' // @concurrent
669+
SENDABLE ::= 'h' // @Sendable
670670
ASYNC ::= 'H' // @async
671671

672672
PARAM-CONVENTION ::= 'i' // indirect in

include/swift/ABI/Metadata.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1657,7 +1657,7 @@ struct TargetFunctionTypeMetadata : public TargetMetadata<Runtime> {
16571657
}
16581658
bool isAsync() const { return Flags.isAsync(); }
16591659
bool isThrowing() const { return Flags.isThrowing(); }
1660-
bool isConcurrent() const { return Flags.isConcurrent(); }
1660+
bool isSendable() const { return Flags.isSendable(); }
16611661
bool hasParameterFlags() const { return Flags.hasParameterFlags(); }
16621662
bool isEscaping() const { return Flags.isEscaping(); }
16631663

include/swift/ABI/MetadataValues.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ class TargetFunctionTypeFlags {
811811
DifferentiabilityMask = 0x98000000U,
812812
DifferentiabilityShift = 27U,
813813
AsyncMask = 0x20000000U,
814-
ConcurrentMask = 0x40000000U,
814+
SendableMask = 0x40000000U,
815815
};
816816
int_type Data;
817817

@@ -861,10 +861,10 @@ class TargetFunctionTypeFlags {
861861
}
862862

863863
constexpr TargetFunctionTypeFlags<int_type>
864-
withConcurrent(bool isConcurrent) const {
864+
withConcurrent(bool isSendable) const {
865865
return TargetFunctionTypeFlags<int_type>(
866-
(Data & ~ConcurrentMask) |
867-
(isConcurrent ? ConcurrentMask : 0));
866+
(Data & ~SendableMask) |
867+
(isSendable ? SendableMask : 0));
868868
}
869869

870870
unsigned getNumParameters() const { return Data & NumParametersMask; }
@@ -881,8 +881,8 @@ class TargetFunctionTypeFlags {
881881
return bool (Data & EscapingMask);
882882
}
883883

884-
bool isConcurrent() const {
885-
return bool (Data & ConcurrentMask);
884+
bool isSendable() const {
885+
return bool (Data & SendableMask);
886886
}
887887

888888
bool hasParameterFlags() const { return bool(Data & ParamFlagsMask); }

include/swift/AST/AnyFunctionRef.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,13 @@ class AnyFunctionRef {
188188
return false;
189189
}
190190

191-
/// Whether this function is @concurrent.
192-
bool isConcurrent() const {
191+
/// Whether this function is @Sendable.
192+
bool isSendable() const {
193193
if (!hasType())
194194
return false;
195195

196196
if (auto *fnType = getType()->getAs<AnyFunctionType>())
197-
return fnType->isConcurrent();
197+
return fnType->isSendable();
198198

199199
return false;
200200
}

include/swift/AST/Attr.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ TYPE_ATTR(escaping)
5454
TYPE_ATTR(differentiable)
5555
TYPE_ATTR(noDerivative)
5656
TYPE_ATTR(async)
57-
TYPE_ATTR(concurrent)
57+
TYPE_ATTR(Sendable)
5858

5959
// SIL-specific attributes
6060
TYPE_ATTR(block_storage)
@@ -601,7 +601,7 @@ CONTEXTUAL_SIMPLE_DECL_ATTR(async, Async,
601601
APIBreakingToAdd | APIBreakingToRemove,
602602
106)
603603

604-
SIMPLE_DECL_ATTR(concurrent, Concurrent,
604+
SIMPLE_DECL_ATTR(Sendable, Sendable,
605605
OnFunc | OnConstructor | OnAccessor |
606606
ABIBreakingToAdd | ABIBreakingToRemove |
607607
APIBreakingToAdd | APIBreakingToRemove,

include/swift/AST/Decl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5738,8 +5738,8 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
57385738

57395739
/// Determine whether the given function is concurrent.
57405740
///
5741-
/// A function is concurrent if it has the @concurrent attribute.
5742-
bool isConcurrent() const;
5741+
/// A function is concurrent if it has the @Sendable attribute.
5742+
bool isSendable() const;
57435743

57445744
/// Returns true if the function is a suitable 'async' context.
57455745
///

include/swift/AST/DiagnosticsSema.def

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3825,18 +3825,18 @@ NOTE(generic_parameters_always_escaping,none,
38253825

38263826
ERROR(passing_noattrfunc_to_attrfunc,none,
38273827
"passing %select{non-escaping|non-concurrent}0 parameter %1 to function "
3828-
"expecting %select{an @escaping|a @concurrent}0 closure",
3828+
"expecting %select{an @escaping|a @Sendable}0 closure",
38293829
(unsigned, Identifier))
38303830
ERROR(converting_noespace_param_to_generic_type,none,
38313831
"converting non-escaping parameter %0 to generic parameter %1 may allow it to escape",
38323832
(Identifier, Type))
38333833
ERROR(assigning_noattrfunc_to_attrfunc,none,
38343834
"assigning %select{non-escaping|non-concurrent}0 parameter %1 to "
3835-
"%select{an @escaping|a @concurrent}0 closure",
3835+
"%select{an @escaping|a @Sendable}0 closure",
38363836
(unsigned, Identifier))
38373837
ERROR(general_noattrfunc_to_attr,none,
38383838
"using %select{non-escaping|non-concurrent}0 parameter %1 in a context "
3839-
"expecting %select{an @escaping|a @concurrent}0 closure",
3839+
"expecting %select{an @escaping|a @Sendable}0 closure",
38403840
(unsigned, Identifier))
38413841
ERROR(converting_noattrfunc_to_type,none,
38423842
"converting %select{non-escaping|non-concurrent function}0 value to %1 "
@@ -4371,7 +4371,7 @@ ERROR(actor_isolated_keypath_component,none,
43714371
"cannot form key path to actor-isolated %0 %1",
43724372
(DescriptiveDeclKind, DeclName))
43734373
ERROR(local_function_executed_concurrently,none,
4374-
"concurrently-executed %0 %1 must be marked as '@concurrent'",
4374+
"concurrently-executed %0 %1 must be marked as '@Sendable'",
43754375
(DescriptiveDeclKind, DeclName))
43764376
ERROR(concurrent_access_of_local_capture,none,
43774377
"%select{mutation of|reference to}0 captured %1 %2 in "

include/swift/AST/ExtInfo.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ class ASTExtInfoBuilder {
298298
enum : unsigned {
299299
RepresentationMask = 0xF << 0,
300300
NoEscapeMask = 1 << 4,
301-
ConcurrentMask = 1 << 5,
301+
SendableMask = 1 << 5,
302302
AsyncMask = 1 << 6,
303303
ThrowsMask = 1 << 7,
304304
DifferentiabilityMaskOffset = 8,
@@ -356,7 +356,7 @@ class ASTExtInfoBuilder {
356356

357357
constexpr bool isNoEscape() const { return bits & NoEscapeMask; }
358358

359-
constexpr bool isConcurrent() const { return bits & ConcurrentMask; }
359+
constexpr bool isSendable() const { return bits & SendableMask; }
360360

361361
constexpr bool isAsync() const { return bits & AsyncMask; }
362362

@@ -419,8 +419,8 @@ class ASTExtInfoBuilder {
419419
}
420420
LLVM_NODISCARD
421421
ASTExtInfoBuilder withConcurrent(bool concurrent = true) const {
422-
return ASTExtInfoBuilder(concurrent ? (bits | ConcurrentMask)
423-
: (bits & ~ConcurrentMask),
422+
return ASTExtInfoBuilder(concurrent ? (bits | SendableMask)
423+
: (bits & ~SendableMask),
424424
clangTypeInfo, globalActor);
425425
}
426426
LLVM_NODISCARD
@@ -524,7 +524,7 @@ class ASTExtInfo {
524524

525525
constexpr bool isNoEscape() const { return builder.isNoEscape(); }
526526

527-
constexpr bool isConcurrent() const { return builder.isConcurrent(); }
527+
constexpr bool isSendable() const { return builder.isSendable(); }
528528

529529
constexpr bool isAsync() const { return builder.isAsync(); }
530530

@@ -648,7 +648,7 @@ class SILExtInfoBuilder {
648648
RepresentationMask = 0xF << 0,
649649
PseudogenericMask = 1 << 4,
650650
NoEscapeMask = 1 << 5,
651-
ConcurrentMask = 1 << 6,
651+
SendableMask = 1 << 6,
652652
AsyncMask = 1 << 7,
653653
DifferentiabilityMaskOffset = 8,
654654
DifferentiabilityMask = 0x7 << DifferentiabilityMaskOffset,
@@ -666,12 +666,12 @@ class SILExtInfoBuilder {
666666
: bits(bits), clangTypeInfo(clangTypeInfo.getCanonical()) {}
667667

668668
static constexpr unsigned makeBits(Representation rep, bool isPseudogeneric,
669-
bool isNoEscape, bool isConcurrent,
669+
bool isNoEscape, bool isSendable,
670670
bool isAsync,
671671
DifferentiabilityKind diffKind) {
672672
return ((unsigned)rep) | (isPseudogeneric ? PseudogenericMask : 0) |
673673
(isNoEscape ? NoEscapeMask : 0) |
674-
(isConcurrent ? ConcurrentMask : 0) |
674+
(isSendable ? SendableMask : 0) |
675675
(isAsync ? AsyncMask : 0) |
676676
(((unsigned)diffKind << DifferentiabilityMaskOffset) &
677677
DifferentiabilityMask);
@@ -687,16 +687,16 @@ class SILExtInfoBuilder {
687687
ClangTypeInfo(nullptr)) {}
688688

689689
SILExtInfoBuilder(Representation rep, bool isPseudogeneric, bool isNoEscape,
690-
bool isConcurrent, bool isAsync,
690+
bool isSendable, bool isAsync,
691691
DifferentiabilityKind diffKind, const clang::Type *type)
692692
: SILExtInfoBuilder(makeBits(rep, isPseudogeneric, isNoEscape,
693-
isConcurrent, isAsync, diffKind),
693+
isSendable, isAsync, diffKind),
694694
ClangTypeInfo(type)) {}
695695

696696
// Constructor for polymorphic type.
697697
SILExtInfoBuilder(ASTExtInfoBuilder info, bool isPseudogeneric)
698698
: SILExtInfoBuilder(makeBits(info.getSILRepresentation(), isPseudogeneric,
699-
info.isNoEscape(), info.isConcurrent(),
699+
info.isNoEscape(), info.isSendable(),
700700
info.isAsync(),
701701
info.getDifferentiabilityKind()),
702702
info.getClangTypeInfo()) {}
@@ -722,7 +722,7 @@ class SILExtInfoBuilder {
722722
// Is this function guaranteed to be no-escape by the type system?
723723
constexpr bool isNoEscape() const { return bits & NoEscapeMask; }
724724

725-
constexpr bool isConcurrent() const { return bits & ConcurrentMask; }
725+
constexpr bool isSendable() const { return bits & SendableMask; }
726726

727727
constexpr bool isAsync() const { return bits & AsyncMask; }
728728

@@ -793,9 +793,9 @@ class SILExtInfoBuilder {
793793
clangTypeInfo);
794794
}
795795
LLVM_NODISCARD
796-
SILExtInfoBuilder withConcurrent(bool isConcurrent = true) const {
797-
return SILExtInfoBuilder(isConcurrent ? (bits | ConcurrentMask)
798-
: (bits & ~ConcurrentMask),
796+
SILExtInfoBuilder withConcurrent(bool isSendable = true) const {
797+
return SILExtInfoBuilder(isSendable ? (bits | SendableMask)
798+
: (bits & ~SendableMask),
799799
clangTypeInfo);
800800
}
801801
LLVM_NODISCARD
@@ -885,7 +885,7 @@ class SILExtInfo {
885885

886886
constexpr bool isNoEscape() const { return builder.isNoEscape(); }
887887

888-
constexpr bool isConcurrent() const { return builder.isConcurrent(); }
888+
constexpr bool isSendable() const { return builder.isSendable(); }
889889

890890
constexpr bool isAsync() const { return builder.isAsync(); }
891891

@@ -915,8 +915,8 @@ class SILExtInfo {
915915
return builder.withNoEscape(noEscape).build();
916916
}
917917

918-
SILExtInfo withConcurrent(bool isConcurrent = true) const {
919-
return builder.withConcurrent(isConcurrent).build();
918+
SILExtInfo withConcurrent(bool isSendable = true) const {
919+
return builder.withConcurrent(isSendable).build();
920920
}
921921

922922
SILExtInfo withAsync(bool isAsync = true) const {

include/swift/AST/TypeMatcher.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ class TypeMatcher {
208208
if (firstFunc->isNoEscape() != secondFunc->isNoEscape())
209209
return mismatch(firstFunc.getPointer(), secondFunc, sugaredFirstType);
210210

211-
if (firstFunc->isConcurrent() != secondFunc->isConcurrent())
211+
if (firstFunc->isSendable() != secondFunc->isSendable())
212212
return mismatch(firstFunc.getPointer(), secondFunc, sugaredFirstType);
213213

214214
auto sugaredFirstFunc = sugaredFirstType->castTo<AnyFunctionType>();

include/swift/AST/Types.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3184,8 +3184,8 @@ class AnyFunctionType : public TypeBase {
31843184
return getExtInfo().isNoEscape();
31853185
}
31863186

3187-
bool isConcurrent() const {
3188-
return getExtInfo().isConcurrent();
3187+
bool isSendable() const {
3188+
return getExtInfo().isSendable();
31893189
}
31903190

31913191
bool isAsync() const { return getExtInfo().isAsync(); }
@@ -4196,7 +4196,7 @@ class SILFunctionType final
41964196
return SILCoroutineKind(Bits.SILFunctionType.CoroutineKind);
41974197
}
41984198

4199-
bool isConcurrent() const { return getExtInfo().isConcurrent(); }
4199+
bool isSendable() const { return getExtInfo().isSendable(); }
42004200
bool isAsync() const { return getExtInfo().isAsync(); }
42014201

42024202
/// Return the array of all the yields.

0 commit comments

Comments
 (0)