mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Concurrency] Implement detecting isIsolatingCurrentContext user impls (#79946)
* [Concurrency] Detect non-default impls of isIsolatingCurrentContext * [Concurrency] No need for trailing info about isIsolating... in conformance * Apply changes from review
This commit is contained in:
committed by
GitHub
parent
1c78d0c683
commit
85fcd69833
@@ -2031,6 +2031,10 @@ bool ModuleDecl::isStdlibModule() const {
|
||||
return !getParent() && getName() == getASTContext().StdlibModuleName;
|
||||
}
|
||||
|
||||
bool ModuleDecl::isConcurrencyModule() const {
|
||||
return !getParent() && getName() == getASTContext().Id_Concurrency;
|
||||
}
|
||||
|
||||
bool ModuleDecl::hasStandardSubstitutions() const {
|
||||
return !getParent() &&
|
||||
(getName() == getASTContext().StdlibModuleName ||
|
||||
@@ -4285,11 +4289,6 @@ struct SwiftSettingsWalker : ASTWalker {
|
||||
|
||||
} // namespace
|
||||
|
||||
static bool isConcurrencyModule(DeclContext *dc) {
|
||||
auto *m = dc->getParentModule();
|
||||
return !m->getParent() && m->getName() == m->getASTContext().Id_Concurrency;
|
||||
}
|
||||
|
||||
bool SwiftSettingsWalker::isSwiftSettingsMacroExpr(
|
||||
MacroExpansionExpr *macroExpr) {
|
||||
// First make sure we actually have a macro with the name SwiftSettings.
|
||||
@@ -4406,7 +4405,8 @@ SwiftSettingsWalker::patternMatchDefaultIsolationMainActor(CallExpr *callExpr) {
|
||||
if (!nomDecl)
|
||||
return CanType();
|
||||
auto *nomDeclDC = nomDecl->getDeclContext();
|
||||
if (!nomDeclDC->isModuleScopeContext() || !isConcurrencyModule(nomDeclDC))
|
||||
auto *nomDeclModule = nomDecl->getParentModule();
|
||||
if (!nomDeclDC->isModuleScopeContext() || !nomDeclModule->isConcurrencyModule())
|
||||
return CanType();
|
||||
|
||||
return nomDecl->getDeclaredType()->getCanonicalType();
|
||||
|
||||
Reference in New Issue
Block a user