Skip to content

Commit 37dbf23

Browse files
committed
Adopt experimental feature approach for flow-sensitive concurrency captures
1 parent 0de5d78 commit 37dbf23

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

include/swift/Basic/Features.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ SUPPRESSIBLE_LANGUAGE_FEATURE(NoAsyncAvailability, 340, "@available(*, noasync)"
8686
EXPERIMENTAL_FEATURE(StaticAssert)
8787
EXPERIMENTAL_FEATURE(VariadicGenerics)
8888
EXPERIMENTAL_FEATURE(NamedOpaqueTypes)
89+
EXPERIMENTAL_FEATURE(FlowSensitiveConcurrencyCaptures)
8990

9091
#undef EXPERIMENTAL_FEATURE
9192
#undef SUPPRESSIBLE_LANGUAGE_FEATURE

include/swift/Basic/LangOptions.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,6 @@ namespace swift {
321321
/// in calls to generic functions.
322322
bool EnableOpenedExistentialTypes = false;
323323

324-
/// Enable experimental flow-sensitive concurrent captures.
325-
bool EnableExperimentalFlowSensitiveConcurrentCaptures = false;
326-
327324
/// Disable experimental ClangImporter diagnostics.
328325
bool DisableExperimentalClangImporterDiagnostics = false;
329326

lib/AST/ASTPrinter.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3007,6 +3007,10 @@ static bool usesFeatureNamedOpaqueTypes(Decl *decl) {
30073007
return false;
30083008
}
30093009

3010+
static bool usesFeatureFlowSensitiveConcurrencyCaptures(Decl *decl) {
3011+
return false;
3012+
}
3013+
30103014
static void
30113015
suppressingFeatureNoAsyncAvailability(PrintOptions &options,
30123016
llvm::function_ref<void()> action) {

lib/Frontend/CompilerInvocation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
465465
Args.hasFlag(OPT_enable_infer_public_concurrent_value,
466466
OPT_disable_infer_public_concurrent_value,
467467
false);
468-
Opts.EnableExperimentalFlowSensitiveConcurrentCaptures |=
469-
Args.hasArg(OPT_enable_experimental_flow_sensitive_concurrent_captures);
470468

471469
Opts.DisableExperimentalClangImporterDiagnostics |=
472470
Args.hasArg(OPT_disable_experimental_clang_importer_diagnostics);
@@ -662,6 +660,8 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
662660
Opts.Features.insert(Feature::StaticAssert);
663661
if (Args.hasArg(OPT_enable_experimental_associated_type_inference))
664662
Opts.Features.insert(Feature::NamedOpaqueTypes);
663+
if (Args.hasArg(OPT_enable_experimental_flow_sensitive_concurrent_captures))
664+
Opts.Features.insert(Feature::FlowSensitiveConcurrencyCaptures);
665665

666666
Opts.EnableAppExtensionRestrictions |= Args.hasArg(OPT_enable_app_extension);
667667

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2634,7 +2634,8 @@ namespace {
26342634
// allow reads, depending on a SIL diagnostic pass to identify the
26352635
// remaining race conditions.
26362636
if (!var->supportsMutation() ||
2637-
(ctx.LangOpts.EnableExperimentalFlowSensitiveConcurrentCaptures &&
2637+
(ctx.LangOpts.hasFeature(
2638+
Feature::FlowSensitiveConcurrencyCaptures) &&
26382639
parent.dyn_cast<LoadExpr *>())) {
26392640
return false;
26402641
}

0 commit comments

Comments
 (0)