Skip to content

Commit 4eefefa

Browse files
authored
Merge pull request #62883 from artemcm/DepScanConcurrencyShims
Add an implicit dependency on the '_SwiftConcurrencyShims' library
2 parents 0763e4b + c5e1b6b commit 4eefefa

17 files changed

+276
-259
lines changed

include/swift/Frontend/Frontend.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,10 @@ class CompilerInstance {
559559
/// i.e. if it can be found.
560560
bool canImportSwiftConcurrency() const;
561561

562+
/// Whether the Swift Concurrency Shims support Clang library can be imported
563+
/// i.e. if it can be found.
564+
bool canImportSwiftConcurrencyShims() const;
565+
562566
/// Verify that if an implicit import of the `StringProcessing` module if
563567
/// expected, it can actually be imported. Emit a warning, otherwise.
564568
void verifyImplicitStringProcessingImport();

include/swift/Strings.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ constexpr static const StringLiteral STDLIB_NAME = "Swift";
2424
constexpr static const StringLiteral SWIFT_ONONE_SUPPORT = "SwiftOnoneSupport";
2525
/// The name of the Concurrency module, which supports that extension.
2626
constexpr static const StringLiteral SWIFT_CONCURRENCY_NAME = "_Concurrency";
27+
/// The name of the Concurrency Shims Clang module
28+
constexpr static const StringLiteral SWIFT_CONCURRENCY_SHIMS_NAME = "_SwiftConcurrencyShims";
2729
/// The name of the Distributed module, which supports that extension.
2830
constexpr static const StringLiteral SWIFT_DISTRIBUTED_NAME = "Distributed";
2931
/// The name of the StringProcessing module, which supports that extension.

lib/Frontend/Frontend.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,13 @@ bool CompilerInstance::canImportSwiftConcurrency() const {
875875
return getASTContext().canImportModule(modulePath);
876876
}
877877

878+
bool CompilerInstance::canImportSwiftConcurrencyShims() const {
879+
ImportPath::Module::Builder builder(
880+
getASTContext().getIdentifier(SWIFT_CONCURRENCY_SHIMS_NAME));
881+
auto modulePath = builder.get();
882+
return getASTContext().canImportModule(modulePath);
883+
}
884+
878885
void CompilerInstance::verifyImplicitStringProcessingImport() {
879886
if (Invocation.shouldImportSwiftStringProcessing() &&
880887
!canImportSwiftStringProcessing()) {
@@ -935,6 +942,8 @@ ImplicitImportInfo CompilerInstance::getImplicitImportInfo() const {
935942
case ImplicitStdlibKind::Stdlib:
936943
if (canImportSwiftConcurrency())
937944
pushImport(SWIFT_CONCURRENCY_NAME);
945+
if (canImportSwiftConcurrencyShims())
946+
pushImport(SWIFT_CONCURRENCY_SHIMS_NAME);
938947
break;
939948
}
940949
}

test/Constraints/overload.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func f4(_ j: Wibble) { } // expected-error{{cannot find type 'Wibble' in scope}}
9292
f4(5)
9393

9494
func f1() {
95-
var c : Class // expected-error{{cannot find type 'Class' in scope}}
95+
var c : Klass // expected-error{{cannot find type 'Klass' in scope}}
9696
markUsed(c.x) // make sure error does not cascade here
9797
}
9898

test/DebugInfo/InlineBridgingHeader.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
// RUN: -emit-ir -g %s -o - | %FileCheck %s
44

55
// The Swift CU must come first.
6-
// CHECK: !llvm.dbg.cu = !{![[SWIFT_CU:[0-9]+]], ![[CLANG_CU:[0-9]+]]}
6+
// CHECK: !llvm.dbg.cu = !{![[SWIFT_CU:[0-9]+]], ![[CLANG_CU:[0-9]+]], ![[CONCURRENCY_SHIMS_CU:[0-9]+]]}
77
// CHECK: ![[SWIFT_CU]] = distinct !DICompileUnit(language: DW_LANG_Swift
88
// CHECK: ![[CLANG_CU]] = distinct !DICompileUnit(
99
// CHECK-SAME: language: {{DW_LANG_ObjC|DW_LANG_C}}
10+
// CHECK: ![[CONCURRENCY_SHIMS_CU]] = distinct !DICompileUnit(
11+
// CHECK-SAME: language: {{DW_LANG_ObjC|DW_LANG_C}}
1012
// CHECK: DISubprogram(name: "Foo"{{.*}} unit: ![[CLANG_CU]],
1113

1214
Foo()

test/ScanDependencies/can_import_placeholder.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ import SomeExternalModule
3838
// CHECK-DAG: "swift": "SwiftOnoneSupport"
3939
// CHECK-DAG: "swift": "_Concurrency"
4040
// CHECK-DAG: "swift": "_StringProcessing"
41+
// CHECK-DAG: "clang": "_SwiftConcurrencyShims"
4142
// CHECK: ],

test/ScanDependencies/module_deps_cache_reuse.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import SubE
4141
// CHECK-DAG: "swift": "_Concurrency"
4242
// CHECK-DAG: "swift": "_StringProcessing"
4343
// CHECK-DAG: "swift": "_cross_import_E"
44+
// CHECK-DAG: "clang": "_SwiftConcurrencyShims"
4445
// CHECK: ],
4546

4647
// CHECK: "extraPcmArgs": [

test/ScanDependencies/module_deps_cross_import_overlay.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ import SubEWrapper
2323
// CHECK-DAG: "swift": "_Concurrency"
2424
// CHECK-DAG: "swift": "_StringProcessing"
2525
// CHECK-DAG: "swift": "_cross_import_E"
26+
// CHECK-DAG: "clang": "_SwiftConcurrencyShims"
2627
// CHECK: ],

test/ScanDependencies/module_deps_external.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import SomeExternalModule
5050
// CHECK-DAG: "swift": "SwiftOnoneSupport"
5151
// CHECK-DAG: "swift": "_Concurrency"
5252
// CHECK-DAG: "swift": "_StringProcessing"
53+
// CHECK-DAG: "clang": "_SwiftConcurrencyShims"
5354
// CHECK: ],
5455

5556
// CHECK: "extraPcmArgs": [

test/ScanDependencies/prescan_deps.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import SubE
2020
// CHECK-NEXT: "SubE",
2121
// CHECK-NEXT: "Swift",
2222
// CHECK-NEXT: "SwiftOnoneSupport",
23-
// CHECK-NEXT: "_Concurrency"
23+
// CHECK-NEXT: "_Concurrency",
24+
// CHECK-NEXT: "_SwiftConcurrencyShims",
2425
// CHECK-NEXT: "_StringProcessing"
2526
// CHECK-NEXT: ]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// RUN: %empty-directory(%t.mod)
2-
// RUN: %swift -emit-module -o %t.mod/cake1.swiftmodule %S/Inputs/cake1.swift -disable-implicit-string-processing-module-import -parse-as-library
2+
// RUN: %swift -emit-module -o %t.mod/cake1.swiftmodule %S/Inputs/cake1.swift -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import -parse-as-library
33
// RUN: %sourcekitd-test -req=doc-info -module cake1 -- -Xfrontend -disable-implicit-concurrency-module-import -Xfrontend -disable-implicit-string-processing-module-import -I %t.mod > %t.response
44
// RUN: %diff -u %s.response %t.response

0 commit comments

Comments
 (0)