Skip to content

Commit 50a82e2

Browse files
committed
[AST] Remove shouldApplyLookDistributedThunk flag from LookupExpr
The underlying mechanism has changed so the flag is no longer required.
1 parent ce64106 commit 50a82e2

File tree

4 files changed

+14
-44
lines changed

4 files changed

+14
-44
lines changed

include/swift/AST/Expr.h

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,10 @@ class alignas(8) Expr : public ASTAllocated<Expr> {
155155

156156
SWIFT_INLINE_BITFIELD_EMPTY(LiteralExpr, Expr);
157157
SWIFT_INLINE_BITFIELD_EMPTY(IdentityExpr, Expr);
158-
SWIFT_INLINE_BITFIELD(LookupExpr, Expr, 1+1+1+1,
158+
SWIFT_INLINE_BITFIELD(LookupExpr, Expr, 1+1+1,
159159
IsSuper : 1,
160160
IsImplicitlyAsync : 1,
161-
IsImplicitlyThrows : 1,
162-
ShouldApplyDistributedThunk: 1
161+
IsImplicitlyThrows : 1
163162
);
164163
SWIFT_INLINE_BITFIELD_EMPTY(DynamicLookupExpr, LookupExpr);
165164

@@ -1656,18 +1655,6 @@ class LookupExpr : public Expr {
16561655
Bits.LookupExpr.IsImplicitlyThrows = isImplicitlyThrows;
16571656
}
16581657

1659-
/// Informs IRGen to that this expression should be applied as its distributed
1660-
/// thunk, rather than invoking the function directly.
1661-
///
1662-
/// Only intended to be set on distributed get-only computed properties.
1663-
bool shouldApplyLookupDistributedThunk() const {
1664-
return Bits.LookupExpr.ShouldApplyDistributedThunk;
1665-
}
1666-
1667-
void setShouldApplyLookupDistributedThunk(bool flag) {
1668-
Bits.LookupExpr.ShouldApplyDistributedThunk = flag;
1669-
}
1670-
16711658
static bool classof(const Expr *E) {
16721659
return E->getKind() >= ExprKind::First_LookupExpr &&
16731660
E->getKind() <= ExprKind::Last_LookupExpr;

lib/AST/ASTDumper.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2035,9 +2035,6 @@ class PrintExpr : public ExprVisitor<PrintExpr> {
20352035

20362036
void visitMemberRefExpr(MemberRefExpr *E) {
20372037
printCommon(E, "member_ref_expr");
2038-
if (E->shouldApplyLookupDistributedThunk()) {
2039-
OS << " distributed";
2040-
}
20412038
PrintWithColorRAII(OS, DeclColor) << " decl=";
20422039
printDeclRef(E->getMember());
20432040
if (E->getAccessSemantics() != AccessSemantics::Ordinary)

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2369,18 +2369,6 @@ namespace {
23692369
} else {
23702370
return AsyncMarkingResult::NotDistributed;
23712371
}
2372-
2373-
// distributed computed property access, mark it throws + async
2374-
if (auto lookupExpr = dyn_cast_or_null<LookupExpr>(context)) {
2375-
if (auto memberRef = dyn_cast<MemberRefExpr>(lookupExpr)) {
2376-
memberRef->setImplicitlyThrows(true);
2377-
memberRef->setShouldApplyLookupDistributedThunk(true);
2378-
} else {
2379-
llvm_unreachable("expected distributed prop to be a MemberRef");
2380-
}
2381-
} else {
2382-
llvm_unreachable("expected distributed prop to have LookupExpr");
2383-
}
23842372
}
23852373

23862374
if (auto declRef = dyn_cast_or_null<DeclRefExpr>(context)) {

lib/Sema/TypeCheckDistributed.cpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include "swift/AST/TypeCheckRequests.h"
2727
#include "swift/AST/TypeVisitor.h"
2828
#include "swift/AST/ExistentialLayout.h"
29-
#include "swift/Basic/Defer.h"
3029

3130
using namespace swift;
3231

@@ -578,36 +577,35 @@ bool swift::checkDistributedActorProperty(VarDecl *var, bool diagnose) {
578577
auto &C = var->getASTContext();
579578
auto DC = var->getDeclContext();
580579

581-
DiagnosticTransaction transaction(C.Diags);
582-
583-
SWIFT_DEFER {
584-
if (!diagnose)
585-
transaction.abort();
586-
};
587-
588580
// without the distributed module, we can't check any of these.
589581
if (!ensureDistributedModuleLoaded(var))
590582
return true;
591583

592584
/// === Check if the declaration is a valid combination of attributes
593585
if (var->isStatic()) {
594-
var->diagnose(diag::distributed_property_cannot_be_static,
595-
var->getName());
586+
if (diagnose) {
587+
var->diagnose(diag::distributed_property_cannot_be_static,
588+
var->getName());
589+
}
596590
// TODO(distributed): fixit, offer removing the static keyword
597591
return true;
598592
}
599593

600594
// it is not a computed property
601595
if (var->isLet() || var->hasStorageOrWrapsStorage()) {
602-
var->diagnose(diag::distributed_property_can_only_be_computed,
603-
var->getDescriptiveKind(), var->getName());
596+
if (diagnose) {
597+
var->diagnose(diag::distributed_property_can_only_be_computed,
598+
var->getDescriptiveKind(), var->getName());
599+
}
604600
return true;
605601
}
606602

607603
// distributed properties cannot have setters
608604
if (var->getWriteImpl() != swift::WriteImplKind::Immutable) {
609-
var->diagnose(diag::distributed_property_can_only_be_computed_get_only,
610-
var->getName());
605+
if (diagnose) {
606+
var->diagnose(diag::distributed_property_can_only_be_computed_get_only,
607+
var->getName());
608+
}
611609
return true;
612610
}
613611

0 commit comments

Comments
 (0)