Skip to content

Commit 53ef38e

Browse files
committed
[AST] NFC: Rename function type isolation NonisolatedCaller to NonisolatedNonsending
This reduces the number of ways we refer to caller isolated async functions and matches the name to the attribute spelling.
1 parent eff13b7 commit 53ef38e

14 files changed

+34
-34
lines changed

include/swift/ABI/MetadataValues.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,7 @@ class TargetExtendedFunctionTypeFlags {
12931293

12941294
// Values for the enumerated isolation kinds
12951295
IsolatedAny = 0x00000002U,
1296-
NonIsolatedCaller = 0x00000004U,
1296+
NonIsolatedNonsending = 0x00000004U,
12971297

12981298
// Values if we have a sending result.
12991299
HasSendingResult = 0x00000010U,
@@ -1328,7 +1328,7 @@ class TargetExtendedFunctionTypeFlags {
13281328
const TargetExtendedFunctionTypeFlags<int_type>
13291329
withNonIsolatedCaller() const {
13301330
return TargetExtendedFunctionTypeFlags<int_type>((Data & ~IsolationMask) |
1331-
NonIsolatedCaller);
1331+
NonIsolatedNonsending);
13321332
}
13331333

13341334
const TargetExtendedFunctionTypeFlags<int_type>
@@ -1352,7 +1352,7 @@ class TargetExtendedFunctionTypeFlags {
13521352
}
13531353

13541354
bool isNonIsolatedCaller() const {
1355-
return (Data & IsolationMask) == NonIsolatedCaller;
1355+
return (Data & IsolationMask) == NonIsolatedNonsending;
13561356
}
13571357

13581358
bool hasSendingResult() const {

include/swift/AST/ExtInfo.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,17 @@ class FunctionTypeIsolation {
6767
/// Inherits isolation from the caller. This is only applicable
6868
/// to asynchronous function types.
6969
///
70-
/// NOTE: The difference in between NonIsolatedCaller and
71-
/// NonIsolated is that NonIsolatedCaller is a strictly
70+
/// NOTE: The difference in between NonIsolatedNonsending and
71+
/// NonIsolated is that NonIsolatedNonsending is a strictly
7272
/// weaker form of nonisolation. While both in their bodies cannot
73-
/// access isolated state directly, NonIsolatedCaller functions
73+
/// access isolated state directly, NonIsolatedNonsending functions
7474
/// /are/ allowed to access state isolated to their caller via
7575
/// function arguments since we know that the callee will stay
7676
/// in the caller's isolation domain. In contrast, NonIsolated
7777
/// is strongly nonisolated and is not allowed to access /any/
7878
/// isolated state (even via function parameters) since it is
7979
/// considered safe to run on /any/ actor.
80-
NonIsolatedCaller,
80+
NonIsolatedNonsending,
8181
};
8282

8383
static constexpr size_t NumBits = 3; // future-proof this slightly
@@ -103,7 +103,7 @@ class FunctionTypeIsolation {
103103
return { Kind::Erased };
104104
}
105105
static FunctionTypeIsolation forNonIsolatedCaller() {
106-
return { Kind::NonIsolatedCaller };
106+
return { Kind::NonIsolatedNonsending };
107107
}
108108

109109
Kind getKind() const { return value.getInt(); }
@@ -124,7 +124,7 @@ class FunctionTypeIsolation {
124124
return getKind() == Kind::Erased;
125125
}
126126
bool isNonIsolatedCaller() const {
127-
return getKind() == Kind::NonIsolatedCaller;
127+
return getKind() == Kind::NonIsolatedNonsending;
128128
}
129129

130130
/// Two function type isolations are equal if they have the same kind and

lib/AST/ASTDumper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6510,7 +6510,7 @@ namespace {
65106510
case FunctionTypeIsolation::Kind::Erased:
65116511
printFlag("@isolated(any)");
65126512
break;
6513-
case FunctionTypeIsolation::Kind::NonIsolatedCaller:
6513+
case FunctionTypeIsolation::Kind::NonIsolatedNonsending:
65146514
printFlag("nonisolated(nonsending)");
65156515
break;
65166516
}

lib/AST/ASTMangler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3389,7 +3389,7 @@ void ASTMangler::appendFunctionSignature(AnyFunctionType *fn,
33893389
appendOperator("YA");
33903390
break;
33913391

3392-
case FunctionTypeIsolation::Kind::NonIsolatedCaller:
3392+
case FunctionTypeIsolation::Kind::NonIsolatedNonsending:
33933393
appendOperator("YC");
33943394
break;
33953395
}

lib/AST/ASTPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6499,7 +6499,7 @@ class TypePrinter : public TypeVisitor<TypePrinter, void, NonRecursivePrintOptio
64996499
Printer << "@isolated(any) ";
65006500
break;
65016501

6502-
case FunctionTypeIsolation::Kind::NonIsolatedCaller:
6502+
case FunctionTypeIsolation::Kind::NonIsolatedNonsending:
65036503
Printer << "nonisolated(nonsending) ";
65046504
break;
65056505
}

lib/SILGen/SILGenConcurrency.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ SILGenFunction::emitFunctionTypeIsolation(SILLocation loc,
571571

572572
// Emit nonisolated by simply emitting Optional.none in the result type.
573573
case FunctionTypeIsolation::Kind::NonIsolated:
574-
case FunctionTypeIsolation::Kind::NonIsolatedCaller:
574+
case FunctionTypeIsolation::Kind::NonIsolatedNonsending:
575575
return emitNonIsolatedIsolation(loc);
576576

577577
// Emit global actor isolation by loading .shared from the global actor,

lib/SILGen/SILGenPoly.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5459,10 +5459,10 @@ static void buildThunkBody(SILGenFunction &SGF, SILLocation loc,
54595459
// isolated parameter preventing us from having to memcpy over the array.
54605460
if (outputSubstType->isAsync()) {
54615461
if (outputSubstType->getIsolation().getKind() ==
5462-
FunctionTypeIsolation::Kind::NonIsolatedCaller)
5462+
FunctionTypeIsolation::Kind::NonIsolatedNonsending)
54635463
options |= ThunkGenFlag::ThunkHasImplicitIsolatedParam;
54645464
if (inputSubstType->getIsolation().getKind() ==
5465-
FunctionTypeIsolation::Kind::NonIsolatedCaller)
5465+
FunctionTypeIsolation::Kind::NonIsolatedNonsending)
54665466
options |= ThunkGenFlag::CalleeHasImplicitIsolatedParam;
54675467
}
54685468

@@ -5526,7 +5526,7 @@ static void buildThunkBody(SILGenFunction &SGF, SILLocation loc,
55265526
// For a function for caller isolation, we'll have to figure out what the
55275527
// output function's formal isolation is. This is quite doable, but we don't
55285528
// have to do it yet.
5529-
case FunctionTypeIsolation::Kind::NonIsolatedCaller:
5529+
case FunctionTypeIsolation::Kind::NonIsolatedNonsending:
55305530
llvm_unreachable("synchronous function has caller isolation?");
55315531

55325532
// For a function with parameter isolation, we'll have to dig the
@@ -5628,7 +5628,7 @@ static void buildThunkBody(SILGenFunction &SGF, SILLocation loc,
56285628
outputIsolation.getGlobalActorType()->getCanonicalType();
56295629
return SGF.emitGlobalActorIsolation(loc, globalActor).getValue();
56305630
}
5631-
case FunctionTypeIsolation::Kind::NonIsolatedCaller: {
5631+
case FunctionTypeIsolation::Kind::NonIsolatedNonsending: {
56325632
return implicitIsolationParam.getValue();
56335633
}
56345634
case FunctionTypeIsolation::Kind::Parameter:

lib/Sema/CSApply.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1323,7 +1323,7 @@ namespace {
13231323
case FunctionTypeIsolation::Kind::GlobalActor:
13241324
return ActorIsolation::forGlobalActor(
13251325
thunkTy->getIsolation().getGlobalActorType());
1326-
case FunctionTypeIsolation::Kind::NonIsolatedCaller:
1326+
case FunctionTypeIsolation::Kind::NonIsolatedNonsending:
13271327
return ActorIsolation::forCallerIsolationInheriting();
13281328
}
13291329
}

lib/Sema/CSSimplify.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2975,7 +2975,7 @@ ConstraintSystem::matchFunctionIsolations(FunctionType *func1,
29752975
return true;
29762976

29772977
// A thunk is going to pass `nil` to the isolated parameter.
2978-
case FunctionTypeIsolation::Kind::NonIsolatedCaller:
2978+
case FunctionTypeIsolation::Kind::NonIsolatedNonsending:
29792979
return matchIfConversion();
29802980

29812981
// Erasing global-actor isolation to non-isolation can admit data
@@ -2999,10 +2999,10 @@ ConstraintSystem::matchFunctionIsolations(FunctionType *func1,
29992999
llvm_unreachable("bad kind");
30003000

30013001
// Converting to a caller isolated async function type.
3002-
case FunctionTypeIsolation::Kind::NonIsolatedCaller:
3002+
case FunctionTypeIsolation::Kind::NonIsolatedNonsending:
30033003
switch (isolation1.getKind()) {
30043004
// Exact match.
3005-
case FunctionTypeIsolation::Kind::NonIsolatedCaller:
3005+
case FunctionTypeIsolation::Kind::NonIsolatedNonsending:
30063006
return true;
30073007

30083008
// Global actor: Thunk will hop to the global actor
@@ -3049,7 +3049,7 @@ ConstraintSystem::matchFunctionIsolations(FunctionType *func1,
30493049

30503050
// A thunk is going to pass in an instance of a global actor
30513051
// to the isolated parameter.
3052-
case FunctionTypeIsolation::Kind::NonIsolatedCaller:
3052+
case FunctionTypeIsolation::Kind::NonIsolatedNonsending:
30533053
return matchIfConversion();
30543054

30553055
// Parameter isolation cannot be altered in the same way.
@@ -3079,7 +3079,7 @@ ConstraintSystem::matchFunctionIsolations(FunctionType *func1,
30793079
return matchIfConversion();
30803080

30813081
// A thunk is going to forward the isolation.
3082-
case FunctionTypeIsolation::Kind::NonIsolatedCaller:
3082+
case FunctionTypeIsolation::Kind::NonIsolatedNonsending:
30833083
return matchIfConversion();
30843084

30853085
// Don't allow dynamically-isolated function types to convert to
@@ -3104,7 +3104,7 @@ ConstraintSystem::matchFunctionIsolations(FunctionType *func1,
31043104

31053105
// It's not possible to form a thunk for this case because
31063106
// we don't know what to pass to the isolated parameter.
3107-
case FunctionTypeIsolation::Kind::NonIsolatedCaller:
3107+
case FunctionTypeIsolation::Kind::NonIsolatedNonsending:
31083108
return false;
31093109

31103110
// Parameter isolation is value-dependent and can't be erased in the

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2763,7 +2763,7 @@ namespace {
27632763

27642764
switch (toIsolation.getKind()) {
27652765
// Converting to `nonisolated(nonsending)` function type
2766-
case FunctionTypeIsolation::Kind::NonIsolatedCaller: {
2766+
case FunctionTypeIsolation::Kind::NonIsolatedNonsending: {
27672767
switch (fromIsolation.getKind()) {
27682768
case FunctionTypeIsolation::Kind::NonIsolated: {
27692769
// nonisolated -> nonisolated(nonsending) doesn't cross
@@ -2783,7 +2783,7 @@ namespace {
27832783
case FunctionTypeIsolation::Kind::Parameter:
27842784
llvm_unreachable("invalid conversion");
27852785

2786-
case FunctionTypeIsolation::Kind::NonIsolatedCaller:
2786+
case FunctionTypeIsolation::Kind::NonIsolatedNonsending:
27872787
// Non isolated caller is always async. This can only occur if we
27882788
// are converting from an `@Sendable` representation to something
27892789
// else. So we need to just check that we diagnose non sendable
@@ -2800,7 +2800,7 @@ namespace {
28002800
case FunctionTypeIsolation::Kind::NonIsolated: {
28012801
switch (fromIsolation.getKind()) {
28022802
case FunctionTypeIsolation::Kind::Parameter:
2803-
case FunctionTypeIsolation::Kind::NonIsolatedCaller:
2803+
case FunctionTypeIsolation::Kind::NonIsolatedNonsending:
28042804
case FunctionTypeIsolation::Kind::Erased:
28052805
diagnoseNonSendableParametersAndResult(
28062806
toFnType, version::Version::getFutureMajorLanguageVersion());
@@ -2851,7 +2851,7 @@ namespace {
28512851
}
28522852

28532853
// Runs on the actor.
2854-
case FunctionTypeIsolation::Kind::NonIsolatedCaller:
2854+
case FunctionTypeIsolation::Kind::NonIsolatedNonsending:
28552855
break;
28562856

28572857
case FunctionTypeIsolation::Kind::GlobalActor:

0 commit comments

Comments
 (0)