Skip to content

Commit a8464dc

Browse files
committed
Implicitly import _Concurrency under -enable-experimental-concurrency
1 parent 8145566 commit a8464dc

File tree

57 files changed

+79
-13
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+79
-13
lines changed

include/swift/Frontend/Frontend.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,10 @@ class CompilerInvocation {
337337
/// Whether the Swift -Onone support library should be implicitly imported.
338338
bool shouldImportSwiftONoneSupport() const;
339339

340+
/// Whether the Swift Concurrency support library should be implicitly
341+
/// imported.
342+
bool shouldImportSwiftConcurrency() const;
343+
340344
/// Performs input setup common to these tools:
341345
/// sil-opt, sil-func-extractor, sil-llvm-gen, and sil-nm.
342346
/// Return value includes the buffer so caller can keep it alive.

include/swift/Strings.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ namespace swift {
2222
constexpr static const StringLiteral STDLIB_NAME = "Swift";
2323
/// The name of the Onone support library, which is a reserved module name.
2424
constexpr static const StringLiteral SWIFT_ONONE_SUPPORT = "SwiftOnoneSupport";
25+
/// The name of the Concurrency module, which supports that extension.
26+
constexpr static const StringLiteral SWIFT_CONCURRENCY_NAME = "_Concurrency";
2527
/// The name of the SwiftShims module, which contains private stdlib decls.
2628
constexpr static const StringLiteral SWIFT_SHIMS_NAME = "SwiftShims";
2729
/// The name of the Builtin module, which contains Builtin functions.

lib/Frontend/Frontend.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,10 @@ CompilerInstance::openModuleDoc(const InputFile &input) {
707707
return None;
708708
}
709709

710+
bool CompilerInvocation::shouldImportSwiftConcurrency() const {
711+
return getLangOptions().EnableExperimentalConcurrency;
712+
}
713+
710714
/// Implicitly import the SwiftOnoneSupport module in non-optimized
711715
/// builds. This allows for use of popular specialized functions
712716
/// from the standard library, which makes the non-optimized builds
@@ -758,6 +762,10 @@ ImplicitImportInfo CompilerInstance::getImplicitImportInfo() const {
758762
pushImport(SWIFT_ONONE_SUPPORT);
759763
}
760764

765+
if (Invocation.shouldImportSwiftConcurrency()) {
766+
pushImport(SWIFT_CONCURRENCY_NAME);
767+
}
768+
761769
imports.ShouldImportUnderlyingModule = frontendOpts.ImportUnderlyingModule;
762770
imports.BridgingHeaderPath = frontendOpts.ImplicitObjCHeaderPath;
763771
return imports;

test/Casting/Casts.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
// RUN: %target-run %t/a.swift5.O.out
2525
//
2626
// REQUIRES: executable_test
27+
// REQUIRES: concurrency
2728
// UNSUPPORTED: use_os_stdlib
2829

2930
import StdlibUnittest

test/ClangImporter/objc_async.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -I %S/Inputs/custom-modules -enable-experimental-concurrency %s -verify
22

33
// REQUIRES: objc_interop
4+
// REQUIRES: concurrency
45
import Foundation
56
import ObjCConcurrency
67

test/Concurrency/actor_isolation.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// RUN: %target-typecheck-verify-swift -enable-experimental-concurrency
22
// REQUIRES: concurrency
33

4-
import _Concurrency
5-
64
let immutableGlobal: String = "hello"
75
var mutableGlobal: String = "can't touch this" // expected-note 2{{var declared here}}
86

test/Concurrency/global_actor_inference.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// RUN: %target-typecheck-verify-swift -enable-experimental-concurrency
22
// REQUIRES: concurrency
33

4-
import _Concurrency
5-
64
actor class SomeActor { }
75

86
@globalActor

test/Constraints/async.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// RUN: %target-typecheck-verify-swift -enable-experimental-concurrency
22

3+
// REQUIRES: concurrency
4+
35
func doAsynchronously() async { }
46
func doSynchronously() { }
57

test/IDE/print_clang_objc_async.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// RUN: %FileCheck -input-file %t/ObjCConcurrency.printed.txt %s
55

66
// REQUIRES: objc_interop
7+
// REQUIRES: concurrency
78

89
// CHECK-LABEL: class SlowServer : NSObject {
910
// CHECK-DAG: func doSomethingSlow(_ operation: String, completionHandler handler: @escaping (Int) -> Void)

test/IRGen/async.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// RUN: %target-swift-frontend -primary-file %s -emit-ir -enable-experimental-concurrency | %FileCheck %s
22

3+
// REQUIRES: concurrency
4+
35
// CHECK: "$s5async1fyyYF"
46
public func f() async { }
57

test/IRGen/async/run-call-classinstance-int64-to-void.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// REQUIRES: executable_test
1010
// REQUIRES: swift_test_mode_optimize_none
11+
// REQUIRES: concurrency
1112
// UNSUPPORTED: use_os_stdlib
1213

1314

test/IRGen/async/run-call-classinstance-void-to-void.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// REQUIRES: executable_test
1010
// REQUIRES: swift_test_mode_optimize_none
11+
// REQUIRES: concurrency
1112
// UNSUPPORTED: use_os_stdlib
1213

1314

test/IRGen/async/run-call-existential-to-void.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// REQUIRES: executable_test
1010
// REQUIRES: swift_test_mode_optimize_none
11+
// REQUIRES: concurrency
1112
// UNSUPPORTED: use_os_stdlib
1213

1314

test/IRGen/async/run-call-generic-to-generic.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// REQUIRES: executable_test
1010
// REQUIRES: swift_test_mode_optimize_none
11+
// REQUIRES: concurrency
1112
// UNSUPPORTED: use_os_stdlib
1213

1314

test/IRGen/async/run-call-generic-to-void.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// REQUIRES: executable_test
1010
// REQUIRES: swift_test_mode_optimize_none
11+
// REQUIRES: concurrency
1112
// UNSUPPORTED: use_os_stdlib
1213

1314

test/IRGen/async/run-call-genericEquatable-x2-to-bool.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// REQUIRES: executable_test
1010
// REQUIRES: swift_test_mode_optimize_none
11+
// REQUIRES: concurrency
1112
// UNSUPPORTED: use_os_stdlib
1213

1314

test/IRGen/async/run-call-int64-and-int64-to-void.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// REQUIRES: executable_test
1010
// REQUIRES: swift_test_mode_optimize_none
11+
// REQUIRES: concurrency
1112
// UNSUPPORTED: use_os_stdlib
1213

1314

test/IRGen/async/run-call-int64-to-void.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// REQUIRES: executable_test
1010
// REQUIRES: swift_test_mode_optimize_none
11+
// REQUIRES: concurrency
1112
// UNSUPPORTED: use_os_stdlib
1213

1314

test/IRGen/async/run-call-protocolextension_instance-void-to-int64.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// REQUIRES: executable_test
1010
// REQUIRES: swift_test_mode_optimize_none
11+
// REQUIRES: concurrency
1112
// UNSUPPORTED: use_os_stdlib
1213

1314
import Builtin

test/IRGen/async/run-call-protocolwitness_instance-void-to-int64.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// REQUIRES: executable_test
1010
// REQUIRES: swift_test_mode_optimize_none
11+
// REQUIRES: concurrency
1112
// UNSUPPORTED: use_os_stdlib
1213

1314
import Builtin

test/IRGen/async/run-call-structinstance-int64-to-void.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// REQUIRES: executable_test
1010
// REQUIRES: swift_test_mode_optimize_none
11+
// REQUIRES: concurrency
1112
// UNSUPPORTED: use_os_stdlib
1213

1314
import Builtin

test/IRGen/async/run-call-void-throws-to-int-throwing.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// REQUIRES: executable_test
1010
// REQUIRES: swift_test_mode_optimize_none
11+
// REQUIRES: concurrency
1112
// UNSUPPORTED: use_os_stdlib
1213

1314

test/IRGen/async/run-call-void-throws-to-int-throwing_call-async-nothrow_call-sync-throw.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// REQUIRES: executable_test
1010
// REQUIRES: swift_test_mode_optimize_none
11+
// REQUIRES: concurrency
1112
// UNSUPPORTED: use_os_stdlib
1213

1314
import Builtin

test/IRGen/async/run-call-void-throws-to-int-throwing_call-async-throw.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// REQUIRES: executable_test
1010
// REQUIRES: swift_test_mode_optimize_none
11+
// REQUIRES: concurrency
1112
// UNSUPPORTED: use_os_stdlib
1213

1314

test/IRGen/async/run-call-void-throws-to-int-throwing_call-sync-nothrow_call-async-throw.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// REQUIRES: executable_test
1010
// REQUIRES: swift_test_mode_optimize_none
11+
// REQUIRES: concurrency
1112
// UNSUPPORTED: use_os_stdlib
1213

1314

test/IRGen/async/run-call-void-throws-to-int-throwing_call-sync-throw.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// REQUIRES: executable_test
1010
// REQUIRES: swift_test_mode_optimize_none
11+
// REQUIRES: concurrency
1112
// UNSUPPORTED: use_os_stdlib
1213

1314

test/IRGen/async/run-call-void-to-existential.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// REQUIRES: executable_test
1010
// REQUIRES: swift_test_mode_optimize_none
11+
// REQUIRES: concurrency
1112
// UNSUPPORTED: use_os_stdlib
1213

1314

test/IRGen/async/run-call-void-to-int64-and-int64.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// REQUIRES: executable_test
1010
// REQUIRES: swift_test_mode_optimize_none
11+
// REQUIRES: concurrency
1112
// UNSUPPORTED: use_os_stdlib
1213

1314

test/IRGen/async/run-call-void-to-int64.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// REQUIRES: executable_test
1010
// REQUIRES: swift_test_mode_optimize_none
11+
// REQUIRES: concurrency
1112
// UNSUPPORTED: use_os_stdlib
1213

1314

test/IRGen/async/run-call-void-to-struct_large.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// REQUIRES: executable_test
1010
// REQUIRES: swift_test_mode_optimize_none
11+
// REQUIRES: concurrency
1112
// UNSUPPORTED: use_os_stdlib
1213

1314
import Builtin

test/IRGen/async/run-call_generic-protocolwitness_instance-generic-to-int64-and-generic.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// REQUIRES: executable_test
1010
// REQUIRES: swift_test_mode_optimize_none
11+
// REQUIRES: concurrency
1112
// UNSUPPORTED: use_os_stdlib
1213

1314
import Builtin

test/IRGen/async/run-call_generic-protocolwitness_instance-void-to-int64.sil

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// REQUIRES: executable_test
1010
// REQUIRES: swift_test_mode_optimize_none
11+
// REQUIRES: concurrency
1112
// UNSUPPORTED: use_os_stdlib
1213

1314
import Builtin

test/IRGen/ptrauth-actor.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// REQUIRES: CPU=arm64e
66
// REQUIRES: OS=macosx
77

8-
import _Concurrency
98
import Swift
109

1110
public actor class A1 {

test/ModuleInterface/actor_isolation.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// RUN: %FileCheck %s --check-prefix FROMMODULE --check-prefix CHECK < %t/TestFromModule.swiftinterface
66

77
// REQUIRES: concurrency
8-
import _Concurrency
98

109
// CHECK: actor public class SomeActor
1110
public actor class SomeActor {

test/ModuleInterface/concurrency.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend -typecheck -enable-library-evolution -enable-experimental-concurrency -emit-module-interface-path %t/Library.swiftinterface -DLIBRARY -module-name Library %s
33

4+
// REQUIRES: concurrency
5+
46
#if LIBRARY
57
public func fn() async {
68
fatalError()

test/Parse/async-syntax.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// RUN: %target-typecheck-verify-swift -enable-experimental-concurrency -verify-syntax-tree
22

3+
// REQUIRES: concurrency
4+
35
func asyncGlobal1() async { }
46
func asyncGlobal2() async throws { }
57

test/Parse/async.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// RUN: %target-typecheck-verify-swift -enable-experimental-concurrency
22

3+
// REQUIRES: concurrency
4+
35
// Parsing function declarations with 'async'
46
func asyncGlobal1() async { }
57
func asyncGlobal2() async throws { }

test/PrintAsObjC/async.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules/AppKit.swift
1010
// FIXME: END -enable-source-import hackaround
1111

12+
// REQUIRES: concurrency
1213

1314
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -parse-as-library %s -typecheck -I %S/Inputs/custom-modules -emit-objc-header-path %t/async.h -import-objc-header %S/../Inputs/empty.h -enable-experimental-concurrency -typecheck
1415
// RUN: %FileCheck %s < %t/async.h

test/Runtime/demangleToMetadata.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// RUN: %target-codesign %t/a.out
44
// RUN: %target-run %t/a.out
55
// REQUIRES: executable_test
6+
// REQUIRES: concurrency
67
// UNSUPPORTED: use_os_stdlib
78

89
import Swift

test/SILGen/synthesized_conformance_actor.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// RUN: %target-swift-frontend -emit-silgen %s -swift-version 5 -enable-experimental-concurrency | %FileCheck -check-prefix CHECK %s
22
// REQUIRES: concurrency
33

4-
import _Concurrency
5-
64
public protocol DefaultInit {
75
init()
86
}

test/Serialization/async.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
// RUN: %target-swift-frontend -merge-modules -emit-module -parse-as-library -enable-testing %t-scratch/def_async~partial.swiftmodule -module-name def_async -o %t/def_async.swiftmodule -enable-experimental-concurrency
55
// RUN: %target-swift-frontend -typecheck -I%t -verify %s -verify-ignore-unknown -enable-experimental-concurrency
66

7+
// REQUIRES: concurrency
8+
79
import def_async
810

911
func testDoSomethingBig() {

test/Serialization/attr-actorindependent.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
// RUN: %target-swift-frontend -enable-experimental-concurrency -emit-module-path %t/b.swiftmodule -module-name a %t/a.swiftmodule
66
// RUN: cmp -s %t/a.swiftmodule %t/b.swiftmodule
77

8+
// REQUIRES: concurrency
9+
810
///////////
911
// This test checks for correct serialization & deserialization of
1012
// @actorIndependent and @actorIndependent(unsafe)
@@ -15,6 +17,8 @@
1517
// MODULE-CHECK-NEXT: @actorIndependent(unsafe) var storage: Int
1618
// MODULE-CHECK-NEXT: @actorIndependent var count: Int
1719
// MODULE-CHECK-NEXT: var actorCount: Int
20+
// MODULE-CHECK-NEXT: @actorIndependent(unsafe) func enqueue(partialTask: PartialAsyncTask)
21+
// MODULE-CHECK-NEXT: var $__actor_storage: _DefaultActorQueue
1822
// MODULE-CHECK-NEXT: init()
1923
// MODULE-CHECK-NEXT: }
2024

test/TypeDecoder/concurrency.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
// RUN: sed -ne '/\/\/ *DEMANGLE-TYPE: /s/\/\/ *DEMANGLE-TYPE: *//p' < %s > %t/input
66
// RUN: %lldb-moduleimport-test-with-sdk %t/concurrency -type-from-mangled=%t/input | %FileCheck %s --check-prefix=CHECK-TYPE
77

8+
// REQUIRES: concurrency
9+
810
func blackHole(_: Any...) {}
911

1012
public var lookAtMeeee: [(Int) async -> Void] = []

test/attr/actorindependent.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// RUN: %target-swift-frontend -typecheck -verify %s -enable-experimental-concurrency
22

3+
// REQUIRES: concurrency
4+
35
// expected-error@+1{{'@actorIndependent' can only be applied to actor members and global/static variables}}
46
@actorIndependent func globalFunction() { }
57

test/attr/actorindependent_unsafe.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// RUN: %target-swift-frontend -typecheck -verify %s -enable-experimental-concurrency
22

3+
// REQUIRES: concurrency
4+
35
//////////////////////////
46
/// Cases that only work because of @actorIndependent(unsafe)
57
//////////////////////////

0 commit comments

Comments
 (0)