Skip to content

Commit 0e49d41

Browse files
xedinktoso
authored andcommitted
[AST] Remove shouldApplyLookDistributedThunk flag from LookupExpr
The underlying mechanism has changed so the flag is no longer required.
1 parent d9fe401 commit 0e49d41

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
@@ -2022,9 +2022,6 @@ class PrintExpr : public ExprVisitor<PrintExpr> {
20222022

20232023
void visitMemberRefExpr(MemberRefExpr *E) {
20242024
printCommon(E, "member_ref_expr");
2025-
if (E->shouldApplyLookupDistributedThunk()) {
2026-
OS << " distributed";
2027-
}
20282025
PrintWithColorRAII(OS, DeclColor) << " decl=";
20292026
printDeclRef(E->getMember());
20302027
if (E->getAccessSemantics() != AccessSemantics::Ordinary)

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2319,18 +2319,6 @@ namespace {
23192319
} else {
23202320
return AsyncMarkingResult::NotDistributed;
23212321
}
2322-
2323-
// distributed computed property access, mark it throws + async
2324-
if (auto lookupExpr = dyn_cast_or_null<LookupExpr>(context)) {
2325-
if (auto memberRef = dyn_cast<MemberRefExpr>(lookupExpr)) {
2326-
memberRef->setImplicitlyThrows(true);
2327-
memberRef->setShouldApplyLookupDistributedThunk(true);
2328-
} else {
2329-
llvm_unreachable("expected distributed prop to be a MemberRef");
2330-
}
2331-
} else {
2332-
llvm_unreachable("expected distributed prop to have LookupExpr");
2333-
}
23342322
}
23352323

23362324
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

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

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

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

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

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

0 commit comments

Comments
 (0)