Skip to content

Commit 242e9fe

Browse files
committed
add the -disable-implicit-concurrency-module-import hidden flag
1 parent c55f546 commit 242e9fe

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@ namespace swift {
241241
/// Enable experimental concurrency model.
242242
bool EnableExperimentalConcurrency = false;
243243

244+
/// Disable the implicit import of the _Concurrency module.
245+
bool DisableImplicitConcurrencyModuleImport = false;
246+
244247
/// Should we check the target OSs of serialized modules to see that they're
245248
/// new enough?
246249
bool EnableTargetOSChecking = true;

include/swift/Option/FrontendOptions.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,10 @@ def disable_clangimporter_source_import : Flag<["-"],
286286
"disable-clangimporter-source-import">,
287287
HelpText<"Disable ClangImporter and forward all requests straight the DWARF importer.">;
288288

289+
def disable_implicit_concurrency_module_import : Flag<["-"],
290+
"disable-implicit-concurrency-module-import">,
291+
HelpText<"Disable the implicit import of the _Concurrency module.">;
292+
289293
def disable_arc_opts : Flag<["-"], "disable-arc-opts">,
290294
HelpText<"Don't run SIL ARC optimization passes.">;
291295
def disable_ossa_opts : Flag<["-"], "disable-ossa-opts">,

lib/Frontend/CompilerInvocation.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,9 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
376376
Opts.EnableExperimentalConcurrency |=
377377
Args.hasArg(OPT_enable_experimental_concurrency);
378378

379+
Opts.DisableImplicitConcurrencyModuleImport |=
380+
Args.hasArg(OPT_disable_implicit_concurrency_module_import);
381+
379382
Opts.EnableSubstSILFunctionTypesForFunctionValues |=
380383
Args.hasArg(OPT_enable_subst_sil_function_types_for_function_values);
381384

lib/Frontend/Frontend.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,8 @@ CompilerInstance::openModuleDoc(const InputFile &input) {
708708
}
709709

710710
bool CompilerInvocation::shouldImportSwiftConcurrency() const {
711-
return getLangOptions().EnableExperimentalConcurrency;
711+
return getLangOptions().EnableExperimentalConcurrency
712+
&& !getLangOptions().DisableImplicitConcurrencyModuleImport;
712713
}
713714

714715
/// Implicitly import the SwiftOnoneSupport module in non-optimized

0 commit comments

Comments
 (0)