Skip to content

Commit 130f5ca

Browse files
committed
Add experimental-async-top-level flag
Protect this feature behind a feature flag until it's ready for prime-time.
1 parent 835beda commit 130f5ca

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,9 @@ namespace swift {
390390
/// cases.
391391
bool EnableNonFrozenEnumExhaustivityDiagnostics = false;
392392

393+
/// Enable making top-level code support concurrency
394+
bool EnableExperimentalAsyncTopLevel = false;
395+
393396
/// Regex for the passes that should report passed and missed optimizations.
394397
///
395398
/// These are shared_ptrs so that this class remains copyable.

include/swift/Option/FrontendOptions.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,10 @@ def enable_experimental_eager_clang_module_diagnostics :
297297

298298
def enable_resilience : Flag<["-"], "enable-resilience">,
299299
HelpText<"Deprecated, use -enable-library-evolution instead">;
300+
301+
def enable_experimental_async_top_level :
302+
Flag<["-"], "enable-experimental-async-top-level">,
303+
HelpText<"Enable experimental concurrency in top-level code">;
300304
}
301305

302306
// HIDDEN FLAGS

lib/Frontend/CompilerInvocation.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,11 +470,16 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
470470
Opts.DisableImplicitConcurrencyModuleImport |=
471471
Args.hasArg(OPT_disable_implicit_concurrency_module_import);
472472

473+
Opts.EnableExperimentalAsyncTopLevel |=
474+
Args.hasArg(OPT_enable_experimental_async_top_level);
475+
473476
/// experimental distributed also implicitly enables experimental concurrency
474477
Opts.EnableExperimentalDistributed |=
475478
Args.hasArg(OPT_enable_experimental_distributed);
476479
Opts.EnableExperimentalConcurrency |=
477480
Args.hasArg(OPT_enable_experimental_distributed);
481+
Opts.EnableExperimentalConcurrency |=
482+
Args.hasArg(OPT_enable_experimental_async_top_level);
478483

479484
Opts.DiagnoseInvalidEphemeralnessAsError |=
480485
Args.hasArg(OPT_enable_invalid_ephemeralness_as_error);

0 commit comments

Comments
 (0)