Skip to content

Commit 76602e4

Browse files
committed
[sending] Rename Sema level APIs from isSendingParameter -> isPassedToSendingParameter.
This came up while I was talking with @xedin. This name makes it really clear what we are trying to communicate to the author. (cherry picked from commit dfc5493)
1 parent 5732909 commit 76602e4

File tree

5 files changed

+25
-21
lines changed

5 files changed

+25
-21
lines changed

include/swift/AST/Expr.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,8 @@ class alignas(8) Expr : public ASTAllocated<Expr> {
283283
/// \c \@preconcurrency declaration.
284284
IsolatedByPreconcurrency : 1,
285285

286-
/// True if this is a closure literal that is passed as a sending parameter.
287-
IsSendingParameter : 1
286+
/// True if this is a closure literal that is passed to a sending parameter.
287+
IsPassedToSendingParameter : 1
288288
);
289289

290290
SWIFT_INLINE_BITFIELD_FULL(BindOptionalExpr, Expr, 16,
@@ -4129,7 +4129,7 @@ class ClosureExpr : public AbstractClosureExpr {
41294129
Bits.ClosureExpr.HasAnonymousClosureVars = false;
41304130
Bits.ClosureExpr.ImplicitSelfCapture = false;
41314131
Bits.ClosureExpr.InheritActorContext = false;
4132-
Bits.ClosureExpr.IsSendingParameter = false;
4132+
Bits.ClosureExpr.IsPassedToSendingParameter = false;
41334133
}
41344134

41354135
SourceRange getSourceRange() const;
@@ -4185,14 +4185,14 @@ class ClosureExpr : public AbstractClosureExpr {
41854185
Bits.ClosureExpr.IsolatedByPreconcurrency = value;
41864186
}
41874187

4188-
/// Whether the closure is a closure literal that is passed as a sending
4188+
/// Whether the closure is a closure literal that is passed to a sending
41894189
/// parameter.
4190-
bool isSendingParameter() const {
4191-
return Bits.ClosureExpr.IsSendingParameter;
4190+
bool isPassedToSendingParameter() const {
4191+
return Bits.ClosureExpr.IsPassedToSendingParameter;
41924192
}
41934193

4194-
void setSendingParameter(bool value = true) {
4195-
Bits.ClosureExpr.IsSendingParameter = value;
4194+
void setIsPassedToSendingParameter(bool value = true) {
4195+
Bits.ClosureExpr.IsPassedToSendingParameter = value;
41964196
}
41974197

41984198
/// Determine whether this closure expression has an

include/swift/AST/Types.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3837,7 +3837,7 @@ struct ParameterListInfo {
38373837
SmallBitVector implicitSelfCapture;
38383838
SmallBitVector inheritActorContext;
38393839
SmallBitVector variadicGenerics;
3840-
SmallBitVector isSending;
3840+
SmallBitVector isPassedToSending;
38413841

38423842
public:
38433843
ParameterListInfo() { }
@@ -3870,7 +3870,7 @@ struct ParameterListInfo {
38703870
bool isVariadicGenericParameter(unsigned paramIdx) const;
38713871

38723872
/// Returns true if this is a sending parameter.
3873-
bool isSendingParameter(unsigned paramIdx) const;
3873+
bool isPassedToSendingParameter(unsigned paramIdx) const;
38743874

38753875
/// Retrieve the number of non-defaulted parameters.
38763876
unsigned numNonDefaultedParameters() const {

lib/AST/Type.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1301,7 +1301,7 @@ ParameterListInfo::ParameterListInfo(
13011301
implicitSelfCapture.resize(params.size());
13021302
inheritActorContext.resize(params.size());
13031303
variadicGenerics.resize(params.size());
1304-
isSending.resize(params.size());
1304+
isPassedToSending.resize(params.size());
13051305

13061306
// No parameter owner means no parameter list means no default arguments
13071307
// - hand back the zeroed bitvector.
@@ -1367,7 +1367,7 @@ ParameterListInfo::ParameterListInfo(
13671367
}
13681368

13691369
if (param->isSending()) {
1370-
isSending.set(i);
1370+
isPassedToSending.set(i);
13711371
}
13721372
}
13731373
}
@@ -1409,8 +1409,9 @@ bool ParameterListInfo::isVariadicGenericParameter(unsigned paramIdx) const {
14091409
: false;
14101410
}
14111411

1412-
bool ParameterListInfo::isSendingParameter(unsigned paramIdx) const {
1413-
return paramIdx < isSending.size() ? isSending[paramIdx] : false;
1412+
bool ParameterListInfo::isPassedToSendingParameter(unsigned paramIdx) const {
1413+
return paramIdx < isPassedToSending.size() ? isPassedToSending[paramIdx]
1414+
: false;
14141415
}
14151416

14161417
/// Turn a param list into a symbolic and printable representation that does not

lib/Sema/CSApply.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5924,23 +5924,24 @@ static bool hasCurriedSelf(ConstraintSystem &cs, ConcreteDeclRef callee,
59245924
/// Apply the contextually Sendable flag to the given expression,
59255925
static void applyContextualClosureFlags(Expr *expr, bool implicitSelfCapture,
59265926
bool inheritActorContext,
5927-
bool isSendingParameter) {
5927+
bool isPassedToSendingParameter) {
59285928
if (auto closure = dyn_cast<ClosureExpr>(expr)) {
59295929
closure->setAllowsImplicitSelfCapture(implicitSelfCapture);
59305930
closure->setInheritsActorContext(inheritActorContext);
5931-
closure->setSendingParameter(isSendingParameter);
5931+
closure->setIsPassedToSendingParameter(isPassedToSendingParameter);
59325932
return;
59335933
}
59345934

59355935
if (auto captureList = dyn_cast<CaptureListExpr>(expr)) {
59365936
applyContextualClosureFlags(captureList->getClosureBody(),
59375937
implicitSelfCapture, inheritActorContext,
5938-
isSendingParameter);
5938+
isPassedToSendingParameter);
59395939
}
59405940

59415941
if (auto identity = dyn_cast<IdentityExpr>(expr)) {
59425942
applyContextualClosureFlags(identity->getSubExpr(), implicitSelfCapture,
5943-
inheritActorContext, isSendingParameter);
5943+
inheritActorContext,
5944+
isPassedToSendingParameter);
59445945
}
59455946
}
59465947

@@ -6168,10 +6169,12 @@ ArgumentList *ExprRewriter::coerceCallArguments(
61686169
// implicit self capture or inheriting actor context.
61696170
bool isImplicitSelfCapture = paramInfo.isImplicitSelfCapture(paramIdx);
61706171
bool inheritsActorContext = paramInfo.inheritsActorContext(paramIdx);
6171-
bool isSendingParameter = paramInfo.isSendingParameter(paramIdx);
6172+
bool isPassedToSendingParameter =
6173+
paramInfo.isPassedToSendingParameter(paramIdx);
61726174

61736175
applyContextualClosureFlags(argExpr, isImplicitSelfCapture,
6174-
inheritsActorContext, isSendingParameter);
6176+
inheritsActorContext,
6177+
isPassedToSendingParameter);
61756178

61766179
// If the types exactly match, this is easy.
61776180
auto paramType = param.getOldType();

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4181,7 +4181,7 @@ namespace {
41814181
// the context.
41824182
if (auto *explicitClosure = dyn_cast<ClosureExpr>(closure)) {
41834183
if (!explicitClosure->inheritsActorContext() &&
4184-
explicitClosure->isSendingParameter())
4184+
explicitClosure->isPassedToSendingParameter())
41854185
return ActorIsolation::forNonisolated(/*unsafe=*/false)
41864186
.withPreconcurrency(preconcurrency);
41874187
}

0 commit comments

Comments
 (0)