Merge pull request #67974 from sophiapoirier/global-static-data-race-safety

enforce under strict concurrency that globals and statics be either…
This commit is contained in:
Sophia Poirier
2023-08-19 08:28:02 -07:00
committed by GitHub
6 changed files with 150 additions and 78 deletions

View File

@@ -954,14 +954,7 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
if (Opts.isSwiftVersionAtLeast(6)) {
Opts.StrictConcurrencyLevel = StrictConcurrency::Complete;
} else if (const Arg *A = Args.getLastArg(OPT_strict_concurrency)) {
auto value =
llvm::StringSwitch<llvm::Optional<StrictConcurrency>>(A->getValue())
.Case("minimal", StrictConcurrency::Minimal)
.Case("targeted", StrictConcurrency::Targeted)
.Case("complete", StrictConcurrency::Complete)
.Default(llvm::None);
if (value)
if (auto value = parseStrictConcurrency(A->getValue()))
Opts.StrictConcurrencyLevel = *value;
else
Diags.diagnose(SourceLoc(), diag::error_invalid_arg_value,