Skip to content

Commit ca6b695

Browse files
committed
Only import _Concurrency implicitly on Darwin and Windows for now.
1 parent 568e943 commit ca6b695

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/Frontend/Frontend.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,8 +753,18 @@ CompilerInstance::openModuleDoc(const InputFile &input) {
753753
return None;
754754
}
755755

756+
/// Enable Swift concurrency on a per-target basis
757+
static bool shouldImportConcurrencyByDefault(const llvm::Triple &target) {
758+
if (target.isOSDarwin())
759+
return true;
760+
if (target.isOSWindows())
761+
return true;
762+
return false;
763+
}
764+
756765
bool CompilerInvocation::shouldImportSwiftConcurrency() const {
757-
return !getLangOptions().DisableImplicitConcurrencyModuleImport &&
766+
return shouldImportConcurrencyByDefault(getLangOptions().Target) &&
767+
!getLangOptions().DisableImplicitConcurrencyModuleImport &&
758768
getFrontendOptions().InputMode !=
759769
FrontendOptions::ParseInputMode::SwiftModuleInterface;
760770
}

0 commit comments

Comments
 (0)