Introduce InoutLifetimeDependence feature

This commit is contained in:
Meghana Gupta
2025-04-02 15:27:29 -07:00
committed by Meghana Gupta
parent f4a980d62d
commit 493f0b782e
3 changed files with 16 additions and 0 deletions

View File

@@ -416,6 +416,9 @@ EXPERIMENTAL_FEATURE(StructLetDestructuring, true)
/// Enable returning non-escapable types from functions.
EXPERIMENTAL_FEATURE(LifetimeDependence, true)
/// Enable inout lifetime dependence - @lifetime(&arg)
EXPERIMENTAL_FEATURE(InoutLifetimeDependence, true)
/// Enable the `@_staticExclusiveOnly` attribute.
EXPERIMENTAL_FEATURE(StaticExclusiveOnly, true)

View File

@@ -271,6 +271,18 @@ static bool usesFeatureLifetimeDependence(Decl *decl) {
return false;
}
static bool usesFeatureInoutLifetimeDependence(Decl *decl) {
for (auto attr : decl->getAttrs().getAttributes<LifetimeAttr>()) {
for (auto source : attr->getLifetimeEntry()->getSources()) {
if (source.getParsedLifetimeDependenceKind() ==
ParsedLifetimeDependenceKind::Inout) {
return true;
}
}
}
return false;
}
UNINTERESTING_FEATURE(DynamicActorIsolation)
UNINTERESTING_FEATURE(NonfrozenEnumExhaustivity)
UNINTERESTING_FEATURE(ClosureIsolation)

View File

@@ -631,6 +631,7 @@ function(_compile_swift_files
list(APPEND swift_flags "-enable-experimental-feature" "NonescapableTypes")
list(APPEND swift_flags "-enable-experimental-feature" "LifetimeDependence")
list(APPEND swift_flags "-enable-experimental-feature" "InoutLifetimeDependence")
list(APPEND swift_flags "-enable-upcoming-feature" "MemberImportVisibility")