Skip to content

[Distributed] Remove _distributedThunkTarget; it is not necessary #72245

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

Merged
merged 1 commit into from
Mar 12, 2024
Merged
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
22 changes: 0 additions & 22 deletions include/swift/AST/Attr.h
Original file line number Diff line number Diff line change
Expand Up @@ -2609,28 +2609,6 @@ class RawLayoutAttr final : public DeclAttribute {
}
};

/// The @_distributedThunkTarget(for:) attribute.
class DistributedThunkTargetAttr final
: public DeclAttribute {

AbstractFunctionDecl *TargetFunction;

public:
DistributedThunkTargetAttr(AbstractFunctionDecl *target)
: DeclAttribute(DeclAttrKind::DistributedThunkTarget, SourceLoc(),
SourceRange(),
/*Implicit=*/false),
TargetFunction(target) {}

AbstractFunctionDecl *getTargetFunction() const {
return TargetFunction;
}

static bool classof(const DeclAttribute *DA) {
return DA->getKind() == DeclAttrKind::DistributedThunkTarget;
}
};

/// Predicate used to filter MatchingAttributeRange.
template <typename ATTR, bool AllowInvalid> struct ToAttributeKind {
ToAttributeKind() {}
Expand Down
4 changes: 1 addition & 3 deletions include/swift/AST/DeclAttr.def
Original file line number Diff line number Diff line change
Expand Up @@ -485,9 +485,7 @@ SIMPLE_DECL_ATTR(_noExistentials, NoExistentials,
SIMPLE_DECL_ATTR(_noObjCBridging, NoObjCBridging,
OnAbstractFunction | OnSubscript | UserInaccessible | ABIStableToAdd | ABIStableToRemove | APIStableToAdd | APIStableToRemove,
155)
DECL_ATTR(_distributedThunkTarget, DistributedThunkTarget,
OnAbstractFunction | UserInaccessible | ABIStableToAdd | ABIBreakingToRemove | APIStableToAdd | APIStableToRemove,
156)
// Unused '156': Used to be `_distributedThunkTarget` but completed implementation in Swift 6.0 does not need it after all
DECL_ATTR(_allowFeatureSuppression, AllowFeatureSuppression,
OnAnyDecl | UserInaccessible | NotSerialized | ABIStableToAdd | APIStableToAdd | ABIStableToRemove | APIStableToRemove,
157)
Expand Down
2 changes: 0 additions & 2 deletions lib/AST/Attr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1918,8 +1918,6 @@ StringRef DeclAttribute::getAttrName() const {
return "_section";
case DeclAttrKind::Documentation:
return "_documentation";
case DeclAttrKind::DistributedThunkTarget:
return "_distributedThunkTarget";
case DeclAttrKind::Nonisolated:
if (cast<NonisolatedAttr>(this)->isUnsafe()) {
return "nonisolated(unsafe)";
Expand Down
3 changes: 1 addition & 2 deletions lib/ASTGen/Sources/ASTGen/DeclAttrs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,7 @@ extension ASTGenVisitor {
.usableFromInline,
.used,
.warnUnqualifiedAccess,
.weakLinked,
.distributedThunkTarget:
.weakLinked:

return self.generateSimpleDeclAttr(attribute: node, kind: attrKind)

Expand Down
5 changes: 0 additions & 5 deletions lib/Parse/ParseDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3704,11 +3704,6 @@ ParserStatus Parser::parseNewDeclAttribute(DeclAttributes &Attributes,
break;
}

case DeclAttrKind::DistributedThunkTarget: {
assert(false && "Not implemented");
break;
}

case DeclAttrKind::TypeEraser: {
// Parse leading '('
if (Tok.isNot(tok::l_paren)) {
Expand Down
4 changes: 0 additions & 4 deletions lib/Sema/CodeSynthesisDistributedActor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,10 +751,6 @@ static FuncDecl *createDistributedThunkFunction(FuncDecl *func) {
if (func->hasBody())
thunk->setBodySynthesizer(deriveBodyDistributed_thunk, func);

/// Record which function this is a thunk for, we'll need this to link back
/// calls in case this is a distributed requirement witness.
thunk->getAttrs().add(new (C) DistributedThunkTargetAttr(func));

return thunk;
}

Expand Down
1 change: 0 additions & 1 deletion lib/Sema/TypeCheckAttr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ class AttributeChecker : public AttributeVisitor<AttributeChecker> {
IGNORED_ATTR(BackDeployed)
IGNORED_ATTR(Documentation)
IGNORED_ATTR(LexicalLifetimes)
IGNORED_ATTR(DistributedThunkTarget)
IGNORED_ATTR(AllowFeatureSuppression)
IGNORED_ATTR(PreInverseGenerics)
#undef IGNORED_ATTR
Expand Down
1 change: 0 additions & 1 deletion lib/Sema/TypeCheckDeclOverride.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1636,7 +1636,6 @@ namespace {
UNINTERESTING_ATTR(NonEscapable)
UNINTERESTING_ATTR(UnsafeNonEscapableResult)
UNINTERESTING_ATTR(StaticExclusiveOnly)
UNINTERESTING_ATTR(DistributedThunkTarget)
UNINTERESTING_ATTR(PreInverseGenerics)
#undef UNINTERESTING_ATTR

Expand Down
8 changes: 0 additions & 8 deletions lib/Serialization/ModuleFormat.h
Original file line number Diff line number Diff line change
Expand Up @@ -2387,14 +2387,6 @@ namespace decls_block {
BCArray<IdentifierIDField>
>;

using DistributedThunkTargetDeclAttrLayout = BCRecordLayout<
DistributedThunkTarget_DECL_ATTR,
BCFixed<1>, // implicit flag
DeclIDField // target function
// FIXME: not entirely right?
>;


using TypeEraserDeclAttrLayout = BCRecordLayout<
TypeEraser_DECL_ATTR,
BCFixed<1>, // implicit flag
Expand Down
3 changes: 0 additions & 3 deletions lib/Serialization/Serialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3065,9 +3065,6 @@ class Serializer::DeclSerializer : public DeclVisitor<DeclSerializer> {
S.addDeclRef(afd), pieces.size(), pieces);
return;
}
case DeclAttrKind::DistributedThunkTarget: {
assert(false && "not implemented");
}

case DeclAttrKind::TypeEraser: {
auto abbrCode = S.DeclTypeAbbrCodes[TypeEraserDeclAttrLayout::Code];
Expand Down