mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #80847 from glessard/rdar149227278-nonescapable-mutating-accessor-62
[6.2, LifetimeDependenceMutableAccessors] defensive feature flag
This commit is contained in:
@@ -422,6 +422,7 @@ EXPERIMENTAL_FEATURE(LifetimeDependence, true)
|
|||||||
|
|
||||||
/// Enable inout lifetime dependence - @lifetime(&arg)
|
/// Enable inout lifetime dependence - @lifetime(&arg)
|
||||||
EXPERIMENTAL_FEATURE(InoutLifetimeDependence, true)
|
EXPERIMENTAL_FEATURE(InoutLifetimeDependence, true)
|
||||||
|
EXPERIMENTAL_FEATURE(LifetimeDependenceMutableAccessors, true)
|
||||||
|
|
||||||
/// Enable the `@_staticExclusiveOnly` attribute.
|
/// Enable the `@_staticExclusiveOnly` attribute.
|
||||||
EXPERIMENTAL_FEATURE(StaticExclusiveOnly, true)
|
EXPERIMENTAL_FEATURE(StaticExclusiveOnly, true)
|
||||||
|
|||||||
@@ -294,6 +294,23 @@ static bool usesFeatureInoutLifetimeDependence(Decl *decl) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool usesFeatureLifetimeDependenceMutableAccessors(Decl *decl) {
|
||||||
|
if (!isa<VarDecl>(decl)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
auto var = cast<VarDecl>(decl);
|
||||||
|
if (!var->isGetterMutating()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (auto dc = var->getDeclContext()) {
|
||||||
|
if (auto nominal = dc->getSelfNominalTypeDecl()) {
|
||||||
|
auto sig = nominal->getGenericSignature();
|
||||||
|
return !var->getInterfaceType()->isEscapable(sig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
UNINTERESTING_FEATURE(DynamicActorIsolation)
|
UNINTERESTING_FEATURE(DynamicActorIsolation)
|
||||||
UNINTERESTING_FEATURE(NonfrozenEnumExhaustivity)
|
UNINTERESTING_FEATURE(NonfrozenEnumExhaustivity)
|
||||||
UNINTERESTING_FEATURE(ClosureIsolation)
|
UNINTERESTING_FEATURE(ClosureIsolation)
|
||||||
|
|||||||
@@ -636,6 +636,7 @@ function(_compile_swift_files
|
|||||||
list(APPEND swift_flags "-enable-experimental-feature" "NonescapableTypes")
|
list(APPEND swift_flags "-enable-experimental-feature" "NonescapableTypes")
|
||||||
list(APPEND swift_flags "-enable-experimental-feature" "LifetimeDependence")
|
list(APPEND swift_flags "-enable-experimental-feature" "LifetimeDependence")
|
||||||
list(APPEND swift_flags "-enable-experimental-feature" "InoutLifetimeDependence")
|
list(APPEND swift_flags "-enable-experimental-feature" "InoutLifetimeDependence")
|
||||||
|
list(APPEND swift_flags "-enable-experimental-feature" "LifetimeDependenceMutableAccessors")
|
||||||
|
|
||||||
list(APPEND swift_flags "-enable-upcoming-feature" "MemberImportVisibility")
|
list(APPEND swift_flags "-enable-upcoming-feature" "MemberImportVisibility")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user