mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #76250 from ktoso/wip-experimental-isolated-deinit
This commit is contained in:
@@ -1033,6 +1033,26 @@ std::optional<CustomAttrNominalPair> Decl::getGlobalActorAttr() const {
|
||||
ctx.evaluator, GlobalActorAttributeRequest{mutableThis}, std::nullopt);
|
||||
}
|
||||
|
||||
bool Decl::hasExplicitIsolationAttribute() const {
|
||||
if (auto nonisolatedAttr = getAttrs().getAttribute<NonisolatedAttr>()) {
|
||||
if (!nonisolatedAttr->isImplicit())
|
||||
return true;
|
||||
}
|
||||
|
||||
if (auto isolatedAttr = getAttrs().getAttribute<IsolatedAttr>()) {
|
||||
if (!isolatedAttr->isImplicit()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (auto globalActorAttr = getGlobalActorAttr()) {
|
||||
if (!globalActorAttr->first->isImplicit())
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Decl::preconcurrency() const {
|
||||
if (getAttrs().hasAttribute<PreconcurrencyAttr>())
|
||||
return true;
|
||||
@@ -3358,6 +3378,16 @@ ValueDecl *ValueDecl::getOverriddenDecl() const {
|
||||
return overridden.front();
|
||||
}
|
||||
|
||||
ValueDecl *ValueDecl::getOverriddenDeclOrSuperDeinit() const {
|
||||
if (auto overridden = getOverriddenDecl()) {
|
||||
return overridden;
|
||||
}
|
||||
if (auto dtor = dyn_cast<DestructorDecl>(this)) {
|
||||
return dtor->getSuperDeinit();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool ValueDecl::overriddenDeclsComputed() const {
|
||||
return LazySemanticInfo.hasOverriddenComputed;
|
||||
}
|
||||
@@ -10603,6 +10633,16 @@ ObjCSelector DestructorDecl::getObjCSelector() const {
|
||||
return ObjCSelector(ctx, 0, ctx.Id_dealloc);
|
||||
}
|
||||
|
||||
DestructorDecl *DestructorDecl::getSuperDeinit() const {
|
||||
auto declContext = getDeclContext()->getImplementedObjCContext();
|
||||
if (auto classDecl = dyn_cast<ClassDecl>(declContext)) {
|
||||
if (auto superclass = classDecl->getSuperclassDecl()) {
|
||||
return superclass->getDestructor();
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SourceRange FuncDecl::getSourceRange() const {
|
||||
SourceLoc StartLoc = getStartLoc();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user