Skip to content

[TypeChecker] NFC: Rename CallerIsolationInheriting to NonisolatedCaller #83147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions include/swift/AST/ActorIsolation.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class ActorIsolation {
///
/// DISCUSSION: This is used for nonisolated asynchronous functions that we
/// want to inherit from their context the context's actor isolation.
CallerIsolationInheriting,
NonisolatedCaller,
};

private:
Expand Down Expand Up @@ -166,10 +166,10 @@ class ActorIsolation {
return ActorIsolation(unsafe ? NonisolatedUnsafe : Nonisolated);
}

static ActorIsolation forCallerIsolationInheriting() {
static ActorIsolation forNonisolatedCaller() {
// NOTE: We do not use parameter indices since the parameter is implicit
// from the perspective of the AST.
return ActorIsolation(CallerIsolationInheriting);
return ActorIsolation(NonisolatedCaller);
}

static ActorIsolation forActorInstanceSelf(ValueDecl *decl);
Expand Down Expand Up @@ -217,7 +217,7 @@ class ActorIsolation {
.Case("global_actor", ActorIsolation::GlobalActor)
.Case("global_actor_unsafe", ActorIsolation::GlobalActor)
.Case("caller_isolation_inheriting",
ActorIsolation::CallerIsolationInheriting)
ActorIsolation::NonisolatedCaller)
.Default(std::nullopt);
if (kind == std::nullopt)
return std::nullopt;
Expand Down Expand Up @@ -267,7 +267,7 @@ class ActorIsolation {
case Unspecified:
case Nonisolated:
case NonisolatedUnsafe:
case CallerIsolationInheriting:
case NonisolatedCaller:
return false;
}
}
Expand All @@ -292,8 +292,8 @@ class ActorIsolation {

bool isDistributedActor() const;

bool isCallerIsolationInheriting() const {
return getKind() == CallerIsolationInheriting;
bool isNonisolatedCaller() const {
return getKind() == NonisolatedCaller;
}

Type getGlobalActor() const {
Expand Down
4 changes: 2 additions & 2 deletions include/swift/SIL/ApplySite.h
Original file line number Diff line number Diff line change
Expand Up @@ -904,9 +904,9 @@ class FullApplySite : public ApplySite {
return calleeFunction->getActorIsolation();
}

bool isCallerIsolationInheriting() const {
bool isNonisolatedCaller() const {
auto isolation = getActorIsolation();
return isolation && isolation->isCallerIsolationInheriting();
return isolation && isolation->isNonisolatedCaller();
}

static FullApplySite getFromOpaqueValue(void *p) { return FullApplySite(p); }
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/ASTDumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1293,7 +1293,7 @@ namespace {
printFlag(true, "dynamically_isolated", CapturesColor);
break;

case ActorIsolation::CallerIsolationInheriting:
case ActorIsolation::NonisolatedCaller:
printFlag(true, "isolated_to_caller_isolation", CapturesColor);
break;

Expand Down
2 changes: 1 addition & 1 deletion lib/AST/ActorIsolation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ bool ActorIsolation::isEqual(const ActorIsolation &lhs,
// to answer.
return false;

case CallerIsolationInheriting:
case NonisolatedCaller:
// This returns false for the same reason as erased. The caller has to check
// against the actual caller isolation.
return false;
Expand Down
4 changes: 2 additions & 2 deletions lib/AST/Decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2975,7 +2975,7 @@ static bool deferMatchesEnclosingAccess(const FuncDecl *defer) {

return true;

case ActorIsolation::CallerIsolationInheriting:
case ActorIsolation::NonisolatedCaller:
case ActorIsolation::ActorInstance:
case ActorIsolation::Nonisolated:
case ActorIsolation::Erased: // really can't happen
Expand Down Expand Up @@ -12007,7 +12007,7 @@ bool VarDecl::isSelfParamCaptureIsolated() const {
case ActorIsolation::NonisolatedUnsafe:
case ActorIsolation::GlobalActor:
case ActorIsolation::Erased:
case ActorIsolation::CallerIsolationInheriting:
case ActorIsolation::NonisolatedCaller:
return false;

case ActorIsolation::ActorInstance:
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/FeatureSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ static bool usesFeatureAsyncExecutionBehaviorAttributes(Decl *decl) {

// The declaration is going to be printed with `nonisolated(nonsending)`
// attribute.
if (getActorIsolation(VD).isCallerIsolationInheriting())
if (getActorIsolation(VD).isNonisolatedCaller())
return true;

// Check if any parameters that have `nonisolated(nonsending)` attribute.
Expand Down
12 changes: 6 additions & 6 deletions lib/AST/TypeCheckRequests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1917,7 +1917,7 @@ SourceLoc MacroDefinitionRequest::getNearestLoc() const {

bool ActorIsolation::requiresSubstitution() const {
switch (kind) {
case CallerIsolationInheriting:
case NonisolatedCaller:
case ActorInstance:
case Nonisolated:
case NonisolatedUnsafe:
Expand All @@ -1933,7 +1933,7 @@ bool ActorIsolation::requiresSubstitution() const {
ActorIsolation ActorIsolation::subst(SubstitutionMap subs) const {
switch (kind) {
case ActorInstance:
case CallerIsolationInheriting:
case NonisolatedCaller:
case Nonisolated:
case NonisolatedUnsafe:
case Unspecified:
Expand All @@ -1954,7 +1954,7 @@ void ActorIsolation::printForDiagnostics(llvm::raw_ostream &os,
os << "actor" << (asNoun ? " isolation" : "-isolated");
break;

case ActorIsolation::CallerIsolationInheriting:
case ActorIsolation::NonisolatedCaller:
os << "caller isolation inheriting"
<< (asNoun ? " isolation" : "-isolated");
break;
Expand Down Expand Up @@ -1995,7 +1995,7 @@ void ActorIsolation::print(llvm::raw_ostream &os) const {
os << ". name: '" << vd->getBaseIdentifier() << "'";
}
return;
case CallerIsolationInheriting:
case NonisolatedCaller:
os << "caller_isolation_inheriting";
return;
case Nonisolated:
Expand All @@ -2022,7 +2022,7 @@ void ActorIsolation::printForSIL(llvm::raw_ostream &os) const {
case ActorInstance:
os << "actor_instance";
return;
case CallerIsolationInheriting:
case NonisolatedCaller:
os << "caller_isolation_inheriting";
return;
case Nonisolated:
Expand Down Expand Up @@ -2081,7 +2081,7 @@ void swift::simple_display(
}
break;

case ActorIsolation::CallerIsolationInheriting:
case ActorIsolation::NonisolatedCaller:
out << "isolated to isolation of caller";
break;

Expand Down
2 changes: 1 addition & 1 deletion lib/IDE/CompletionLookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ void CompletionLookup::analyzeActorIsolation(
break;
case ActorIsolation::Unspecified:
case ActorIsolation::Nonisolated:
case ActorIsolation::CallerIsolationInheriting:
case ActorIsolation::NonisolatedCaller:
case ActorIsolation::NonisolatedUnsafe:
return;
}
Expand Down
8 changes: 4 additions & 4 deletions lib/SIL/IR/SILFunctionType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1702,7 +1702,7 @@ class DestructureInputs {
// NOTE: The parameter is not inserted for async functions imported
// from ObjC because they are handled in a special way that doesn't
// require it.
if (IsolationInfo && IsolationInfo->isCallerIsolationInheriting() &&
if (IsolationInfo && IsolationInfo->isNonisolatedCaller() &&
extInfoBuilder.isAsync() && !Foreign.async) {
auto actorProtocol = TC.Context.getProtocol(KnownProtocolKind::Actor);
auto actorType =
Expand Down Expand Up @@ -2397,7 +2397,7 @@ swift::getSILFunctionTypeActorIsolation(CanAnyFunctionType substFnInterfaceType,
if (auto *nonisolatedAttr =
decl->getAttrs().getAttribute<NonisolatedAttr>()) {
if (nonisolatedAttr->isNonSending())
return ActorIsolation::forCallerIsolationInheriting();
return ActorIsolation::forNonisolatedCaller();
}

if (decl->getAttrs().hasAttribute<ConcurrentAttr>()) {
Expand All @@ -2421,7 +2421,7 @@ swift::getSILFunctionTypeActorIsolation(CanAnyFunctionType substFnInterfaceType,
if (auto *nonisolatedAttr =
decl->getAttrs().getAttribute<NonisolatedAttr>()) {
if (nonisolatedAttr->isNonSending())
return ActorIsolation::forCallerIsolationInheriting();
return ActorIsolation::forNonisolatedCaller();
}

if (decl->getAttrs().hasAttribute<ConcurrentAttr>()) {
Expand All @@ -2441,7 +2441,7 @@ swift::getSILFunctionTypeActorIsolation(CanAnyFunctionType substFnInterfaceType,
substFnInterfaceType->getExtInfo().getIsolation().isNonIsolatedCaller()) {
// If our function type is a nonisolated caller and we can not infer from
// our constant, we must be caller isolation inheriting.
return ActorIsolation::forCallerIsolationInheriting();
return ActorIsolation::forNonisolatedCaller();
}

return {};
Expand Down
4 changes: 2 additions & 2 deletions lib/SILGen/SILGenApply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3165,7 +3165,7 @@ static void emitDelayedArguments(SILGenFunction &SGF,

case ActorIsolation::Unspecified:
case ActorIsolation::Nonisolated:
case ActorIsolation::CallerIsolationInheriting:
case ActorIsolation::NonisolatedCaller:
case ActorIsolation::NonisolatedUnsafe:
llvm_unreachable("Not isolated");
}
Expand Down Expand Up @@ -6151,7 +6151,7 @@ RValue SILGenFunction::emitApply(

case ActorIsolation::Unspecified:
case ActorIsolation::Nonisolated:
case ActorIsolation::CallerIsolationInheriting:
case ActorIsolation::NonisolatedCaller:
case ActorIsolation::NonisolatedUnsafe:
llvm_unreachable("Not isolated");
break;
Expand Down
2 changes: 1 addition & 1 deletion lib/SILGen/SILGenBridging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1671,7 +1671,7 @@ void SILGenFunction::emitNativeToForeignThunk(SILDeclRef thunk) {
case ActorIsolation::Unspecified:
case ActorIsolation::Nonisolated:
case ActorIsolation::NonisolatedUnsafe:
case ActorIsolation::CallerIsolationInheriting:
case ActorIsolation::NonisolatedCaller:
args.push_back(emitNonIsolatedIsolation(loc).getValue());
break;
case ActorIsolation::ActorInstance:
Expand Down
12 changes: 6 additions & 6 deletions lib/SILGen/SILGenConcurrency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ setExpectedExecutorForParameterIsolation(SILGenFunction &SGF,

// If we have caller isolation inheriting... just grab from our isolated
// argument.
if (actorIsolation.getKind() == ActorIsolation::CallerIsolationInheriting) {
if (actorIsolation.getKind() == ActorIsolation::NonisolatedCaller) {
auto *isolatedArg = SGF.F.maybeGetIsolatedArgument();
ASSERT(isolatedArg &&
"Caller Isolation Inheriting without isolated parameter");
Expand Down Expand Up @@ -110,7 +110,7 @@ void SILGenFunction::emitExpectedExecutorProlog() {
case ActorIsolation::Nonisolated:
case ActorIsolation::NonisolatedUnsafe:
case ActorIsolation::Unspecified:
case ActorIsolation::CallerIsolationInheriting:
case ActorIsolation::NonisolatedCaller:
return false;

case ActorIsolation::Erased:
Expand Down Expand Up @@ -189,7 +189,7 @@ void SILGenFunction::emitExpectedExecutorProlog() {
break;
}

case ActorIsolation::CallerIsolationInheriting:
case ActorIsolation::NonisolatedCaller:
assert(F.isAsync());
setExpectedExecutorForParameterIsolation(*this, actorIsolation);
break;
Expand All @@ -211,7 +211,7 @@ void SILGenFunction::emitExpectedExecutorProlog() {
case ActorIsolation::NonisolatedUnsafe:
break;

case ActorIsolation::CallerIsolationInheriting:
case ActorIsolation::NonisolatedCaller:
assert(F.isAsync());
setExpectedExecutorForParameterIsolation(*this, actorIsolation);
break;
Expand Down Expand Up @@ -643,7 +643,7 @@ SILGenFunction::emitClosureIsolation(SILLocation loc, SILDeclRef constant,
switch (isolation) {
case ActorIsolation::Unspecified:
case ActorIsolation::Nonisolated:
case ActorIsolation::CallerIsolationInheriting:
case ActorIsolation::NonisolatedCaller:
case ActorIsolation::NonisolatedUnsafe:
return emitNonIsolatedIsolation(loc);

Expand Down Expand Up @@ -695,7 +695,7 @@ SILGenFunction::emitExecutor(SILLocation loc, ActorIsolation isolation,
switch (isolation.getKind()) {
case ActorIsolation::Unspecified:
case ActorIsolation::Nonisolated:
case ActorIsolation::CallerIsolationInheriting:
case ActorIsolation::NonisolatedCaller:
case ActorIsolation::NonisolatedUnsafe:
return std::nullopt;

Expand Down
4 changes: 2 additions & 2 deletions lib/SILGen/SILGenConstructor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ static bool ctorHopsInjectedByDefiniteInit(ConstructorDecl *ctor,
case ActorIsolation::Nonisolated:
case ActorIsolation::NonisolatedUnsafe:
case ActorIsolation::GlobalActor:
case ActorIsolation::CallerIsolationInheriting:
case ActorIsolation::NonisolatedCaller:
return false;
}
}
Expand Down Expand Up @@ -1558,7 +1558,7 @@ void SILGenFunction::emitMemberInitializer(DeclContext *dc, VarDecl *selfDecl,
case ActorIsolation::Unspecified:
case ActorIsolation::Nonisolated:
case ActorIsolation::NonisolatedUnsafe:
case ActorIsolation::CallerIsolationInheriting:
case ActorIsolation::NonisolatedCaller:
break;

case ActorIsolation::Erased:
Expand Down
8 changes: 4 additions & 4 deletions lib/SILGen/SILGenExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2016,7 +2016,7 @@ RValueEmitter::emitFunctionCvtToExecutionCaller(FunctionConversionExpr *e,
return RValue();

auto *decl = dyn_cast<FuncDecl>(declRef->getDecl());
if (!decl || !getActorIsolation(decl).isCallerIsolationInheriting())
if (!decl || !getActorIsolation(decl).isNonisolatedCaller())
return RValue();

// Ok, we found our target.
Expand Down Expand Up @@ -2049,7 +2049,7 @@ RValue RValueEmitter::emitFunctionCvtForNonisolatedNonsendingClosureExpr(
// inheriting, bail.
auto *closureExpr = dyn_cast<ClosureExpr>(subExpr);
if (!closureExpr ||
!closureExpr->getActorIsolation().isCallerIsolationInheriting())
!closureExpr->getActorIsolation().isNonisolatedCaller())
return RValue();

// Then grab our closure type... make sure it is non isolated and then make
Expand Down Expand Up @@ -2116,7 +2116,7 @@ RValue RValueEmitter::emitFunctionCvtFromExecutionCallerToGlobalActor(
if (!declRef)
return RValue();
auto *decl = dyn_cast<FuncDecl>(declRef->getDecl());
if (!decl || !getActorIsolation(decl).isCallerIsolationInheriting())
if (!decl || !getActorIsolation(decl).isNonisolatedCaller())
return RValue();

// Make sure that subCvt/declRefType only differ by isolation and sendability.
Expand Down Expand Up @@ -7375,7 +7375,7 @@ RValue RValueEmitter::visitCurrentContextIsolationExpr(
return RValue(SGF, E, isolationValue);
}

if (isolation == ActorIsolation::CallerIsolationInheriting) {
if (isolation == ActorIsolation::NonisolatedCaller) {
auto *isolatedArg = SGF.F.maybeGetIsolatedArgument();
assert(isolatedArg &&
"Caller Isolation Inheriting without isolated parameter");
Expand Down
8 changes: 4 additions & 4 deletions lib/SILGen/SILGenPoly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7095,7 +7095,7 @@ SILGenFunction::emitVTableThunk(SILDeclRef base,
break;
}
case ActorIsolation::ActorInstance:
case ActorIsolation::CallerIsolationInheriting: {
case ActorIsolation::NonisolatedCaller: {
auto derivedIsolation =
swift::getActorIsolation(derived.getAbstractFunctionDecl());
switch (derivedIsolation) {
Expand All @@ -7114,7 +7114,7 @@ SILGenFunction::emitVTableThunk(SILDeclRef base,
break;
}
case ActorIsolation::ActorInstance:
case ActorIsolation::CallerIsolationInheriting: {
case ActorIsolation::NonisolatedCaller: {
auto isolatedArg = F.maybeGetIsolatedArgument();
assert(isolatedArg);
args.push_back(isolatedArg);
Expand Down Expand Up @@ -7575,7 +7575,7 @@ void SILGenFunction::emitProtocolWitness(
break;
}
case ActorIsolation::ActorInstance:
case ActorIsolation::CallerIsolationInheriting: {
case ActorIsolation::NonisolatedCaller: {
auto witnessIsolation =
swift::getActorIsolation(witness.getAbstractFunctionDecl());
switch (witnessIsolation) {
Expand All @@ -7594,7 +7594,7 @@ void SILGenFunction::emitProtocolWitness(
break;
}
case ActorIsolation::ActorInstance:
case ActorIsolation::CallerIsolationInheriting: {
case ActorIsolation::NonisolatedCaller: {
auto isolatedArg = F.maybeGetIsolatedArgument();
assert(isolatedArg);
args.push_back(isolatedArg);
Expand Down
2 changes: 1 addition & 1 deletion lib/SILOptimizer/Mandatory/DefiniteInitialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,7 @@ void LifetimeChecker::injectActorHops() {

case ActorIsolation::Unspecified:
case ActorIsolation::Nonisolated:
case ActorIsolation::CallerIsolationInheriting:
case ActorIsolation::NonisolatedCaller:
case ActorIsolation::NonisolatedUnsafe:
case ActorIsolation::GlobalActor:
return;
Expand Down
Loading