mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #80219 from xedin/rdar-145768557
[Concurrency] SE-0466: Replace `UnspecifiedMeansMainActorIsolated` flag with `-default-isolation`
This commit is contained in:
@@ -969,9 +969,6 @@ static bool ParseEnabledFeatureArgs(LangOptions &Opts, ArgList &Args,
|
||||
if (Args.hasArg(OPT_strict_memory_safety))
|
||||
Opts.enableFeature(Feature::StrictMemorySafety);
|
||||
|
||||
if (Opts.hasFeature(Feature::UnspecifiedMeansMainActorIsolated))
|
||||
Opts.enableFeature(Feature::InferIsolatedConformances);
|
||||
|
||||
return HadError;
|
||||
}
|
||||
|
||||
@@ -1817,6 +1814,27 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
|
||||
Opts.DisableDynamicActorIsolation |=
|
||||
Args.hasArg(OPT_disable_dynamic_actor_isolation);
|
||||
|
||||
if (const Arg *A = Args.getLastArg(options::OPT_default_isolation)) {
|
||||
auto behavior =
|
||||
llvm::StringSwitch<std::optional<DefaultIsolation>>(A->getValue())
|
||||
.Case("MainActor", DefaultIsolation::MainActor)
|
||||
.Case("nonisolated", DefaultIsolation::Nonisolated)
|
||||
.Default(std::nullopt);
|
||||
|
||||
if (behavior) {
|
||||
Opts.DefaultIsolationBehavior = *behavior;
|
||||
} else {
|
||||
Diags.diagnose(SourceLoc(), diag::error_invalid_arg_value,
|
||||
A->getAsString(Args), A->getValue());
|
||||
HadError = true;
|
||||
}
|
||||
} else {
|
||||
Opts.DefaultIsolationBehavior = DefaultIsolation::Nonisolated;
|
||||
}
|
||||
|
||||
if (Opts.DefaultIsolationBehavior == DefaultIsolation::MainActor)
|
||||
Opts.enableFeature(Feature::InferIsolatedConformances);
|
||||
|
||||
#if !defined(NDEBUG) && SWIFT_ENABLE_EXPERIMENTAL_PARSER_VALIDATION
|
||||
/// Enable round trip parsing via the new swift parser unless it is disabled
|
||||
/// explicitly. The new Swift parser can have mismatches with C++ parser -
|
||||
|
||||
Reference in New Issue
Block a user