Skip to content

Commit 5e27999

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.
1 parent b541e02 commit 5e27999

File tree

5 files changed

+25
-21
lines changed

5 files changed

+25
-21
lines changed

Diff for: include/swift/AST/Expr.h

+8-8
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,
@@ -4142,7 +4142,7 @@ class ClosureExpr : public AbstractClosureExpr {
41424142
Bits.ClosureExpr.HasAnonymousClosureVars = false;
41434143
Bits.ClosureExpr.ImplicitSelfCapture = false;
41444144
Bits.ClosureExpr.InheritActorContext = false;
4145-
Bits.ClosureExpr.IsSendingParameter = false;
4145+
Bits.ClosureExpr.IsPassedToSendingParameter = false;
41464146
}
41474147

41484148
SourceRange getSourceRange() const;
@@ -4198,14 +4198,14 @@ class ClosureExpr : public AbstractClosureExpr {
41984198
Bits.ClosureExpr.IsolatedByPreconcurrency = value;
41994199
}
42004200

4201-
/// Whether the closure is a closure literal that is passed as a sending
4201+
/// Whether the closure is a closure literal that is passed to a sending
42024202
/// parameter.
4203-
bool isSendingParameter() const {
4204-
return Bits.ClosureExpr.IsSendingParameter;
4203+
bool isPassedToSendingParameter() const {
4204+
return Bits.ClosureExpr.IsPassedToSendingParameter;
42054205
}
42064206

4207-
void setSendingParameter(bool value = true) {
4208-
Bits.ClosureExpr.IsSendingParameter = value;
4207+
void setIsPassedToSendingParameter(bool value = true) {
4208+
Bits.ClosureExpr.IsPassedToSendingParameter = value;
42094209
}
42104210

42114211
/// Determine whether this closure expression has an

Diff for: include/swift/AST/Types.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -3832,7 +3832,7 @@ struct ParameterListInfo {
38323832
SmallBitVector implicitSelfCapture;
38333833
SmallBitVector inheritActorContext;
38343834
SmallBitVector variadicGenerics;
3835-
SmallBitVector isSending;
3835+
SmallBitVector isPassedToSending;
38363836

38373837
public:
38383838
ParameterListInfo() { }
@@ -3865,7 +3865,7 @@ struct ParameterListInfo {
38653865
bool isVariadicGenericParameter(unsigned paramIdx) const;
38663866

38673867
/// Returns true if this is a sending parameter.
3868-
bool isSendingParameter(unsigned paramIdx) const;
3868+
bool isPassedToSendingParameter(unsigned paramIdx) const;
38693869

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

Diff for: lib/AST/Type.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -1302,7 +1302,7 @@ ParameterListInfo::ParameterListInfo(
13021302
implicitSelfCapture.resize(params.size());
13031303
inheritActorContext.resize(params.size());
13041304
variadicGenerics.resize(params.size());
1305-
isSending.resize(params.size());
1305+
isPassedToSending.resize(params.size());
13061306

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

13701370
if (param->isSending()) {
1371-
isSending.set(i);
1371+
isPassedToSending.set(i);
13721372
}
13731373
}
13741374
}
@@ -1410,8 +1410,9 @@ bool ParameterListInfo::isVariadicGenericParameter(unsigned paramIdx) const {
14101410
: false;
14111411
}
14121412

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

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

Diff for: lib/Sema/CSApply.cpp

+9-6
Original file line numberDiff line numberDiff line change
@@ -5965,23 +5965,24 @@ static bool hasCurriedSelf(ConstraintSystem &cs, ConcreteDeclRef callee,
59655965
/// Apply the contextually Sendable flag to the given expression,
59665966
static void applyContextualClosureFlags(Expr *expr, bool implicitSelfCapture,
59675967
bool inheritActorContext,
5968-
bool isSendingParameter) {
5968+
bool isPassedToSendingParameter) {
59695969
if (auto closure = dyn_cast<ClosureExpr>(expr)) {
59705970
closure->setAllowsImplicitSelfCapture(implicitSelfCapture);
59715971
closure->setInheritsActorContext(inheritActorContext);
5972-
closure->setSendingParameter(isSendingParameter);
5972+
closure->setIsPassedToSendingParameter(isPassedToSendingParameter);
59735973
return;
59745974
}
59755975

59765976
if (auto captureList = dyn_cast<CaptureListExpr>(expr)) {
59775977
applyContextualClosureFlags(captureList->getClosureBody(),
59785978
implicitSelfCapture, inheritActorContext,
5979-
isSendingParameter);
5979+
isPassedToSendingParameter);
59805980
}
59815981

59825982
if (auto identity = dyn_cast<IdentityExpr>(expr)) {
59835983
applyContextualClosureFlags(identity->getSubExpr(), implicitSelfCapture,
5984-
inheritActorContext, isSendingParameter);
5984+
inheritActorContext,
5985+
isPassedToSendingParameter);
59855986
}
59865987
}
59875988

@@ -6209,10 +6210,12 @@ ArgumentList *ExprRewriter::coerceCallArguments(
62096210
// implicit self capture or inheriting actor context.
62106211
bool isImplicitSelfCapture = paramInfo.isImplicitSelfCapture(paramIdx);
62116212
bool inheritsActorContext = paramInfo.inheritsActorContext(paramIdx);
6212-
bool isSendingParameter = paramInfo.isSendingParameter(paramIdx);
6213+
bool isPassedToSendingParameter =
6214+
paramInfo.isPassedToSendingParameter(paramIdx);
62136215

62146216
applyContextualClosureFlags(argExpr, isImplicitSelfCapture,
6215-
inheritsActorContext, isSendingParameter);
6217+
inheritsActorContext,
6218+
isPassedToSendingParameter);
62166219

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

Diff for: lib/Sema/TypeCheckConcurrency.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4188,7 +4188,7 @@ namespace {
41884188
// the context.
41894189
if (auto *explicitClosure = dyn_cast<ClosureExpr>(closure)) {
41904190
if (!explicitClosure->inheritsActorContext() &&
4191-
explicitClosure->isSendingParameter())
4191+
explicitClosure->isPassedToSendingParameter())
41924192
return ActorIsolation::forNonisolated(/*unsafe=*/false)
41934193
.withPreconcurrency(preconcurrency);
41944194
}

0 commit comments

Comments
 (0)