2
2
3
3
// RUN: %empty-directory(%t)
4
4
// RUN: %target-build-swift -O -wmo -parse-as-library -cross-module-optimization -emit-module -emit-module-path=%t/Submodule.swiftmodule -module-name=Submodule %S/Inputs/cross-submodule.swift -c -o %t/submodule.o
5
+ // RUN: %target-build-swift -O -wmo -parse-as-library -cross-module-optimization -emit-module -emit-module-path=%t/PrivateSubmodule.swiftmodule -module-name=PrivateSubmodule %S/Inputs/cross-private-submodule.swift -c -o %t/privatesubmodule.o
5
6
// RUN: %target-build-swift -O -wmo -parse-as-library -cross-module-optimization -emit-module -emit-module-path=%t/Test.swiftmodule -module-name=Test -I%t %S/Inputs/cross-module.swift -c -o %t/test.o
6
7
// RUN: %target-build-swift -O -wmo -module-name=Main -I%t %s -c -o %t/main.o
7
- // RUN: %target-swiftc_driver %t/main.o %t/test.o %t/submodule.o -o %t/a.out
8
+ // RUN: %target-swiftc_driver %t/main.o %t/test.o %t/submodule.o %t/privatesubmodule.o -o %t/a.out
8
9
// RUN: %target-codesign %t/a.out
9
10
// RUN: %target-run %t/a.out | %FileCheck %s -check-prefix=CHECK-OUTPUT
10
11
11
12
// Check if it also works if the main module is compiled with -Onone:
12
13
13
14
// RUN: %target-build-swift -Onone -wmo -module-name=Main -I%t %s -c -o %t/main-onone.o
14
- // RUN: %target-swiftc_driver %t/main-onone.o %t/test.o %t/submodule.o -o %t/a.out
15
+ // RUN: %target-swiftc_driver %t/main-onone.o %t/test.o %t/submodule.o %t/privatesubmodule.o -o %t/a.out
15
16
// RUN: %target-codesign %t/a.out
16
17
// RUN: %target-run %t/a.out | %FileCheck %s -check-prefix=CHECK-OUTPUT
17
18
@@ -29,19 +30,19 @@ import Test
29
30
func testNestedTypes( ) {
30
31
let c = Container ( )
31
32
32
- // CHECK-OUTPUT: [Test.Container.Base]
33
+ // CHECK-OUTPUT [Test.Container.Base]
33
34
// CHECK-OUTPUT: 27
34
35
// CHECK-SIL-DAG: sil shared [noinline] @$s4Test9ContainerV9testclassyxxlFSi_Tg5
35
36
print ( c. testclass ( 27 ) )
36
- // CHECK-OUTPUT: [Test.Container.Base]
37
+ // CHECK-OUTPUT [Test.Container.Base]
37
38
// CHECK-OUTPUT: 27
38
39
// CHECK-SIL-DAG: sil shared_external {{.*}} @$s4Test9ContainerV13testclass_genyxxlF
39
40
print ( c. testclass_gen ( 27 ) )
40
- // CHECK-OUTPUT: [Test.PE<Swift.Int>.B(27)]
41
+ // CHECK-OUTPUT [Test.PE<Swift.Int>.B(27)]
41
42
// CHECK-OUTPUT: 27
42
43
// CHECK-SIL-DAG: sil shared [noinline] @$s4Test9ContainerV8testenumyxxlFSi_Tg5
43
44
print ( c. testenum ( 27 ) )
44
- // CHECK-OUTPUT: [Test.PE<Swift.Int>.B(27)]
45
+ // CHECK-OUTPUT [Test.PE<Swift.Int>.B(27)]
45
46
// CHECK-OUTPUT: 27
46
47
// CHECK-SIL-DAG: sil shared_external {{.*}} @$s4Test9ContainerV12testenum_genyxxlF
47
48
print ( c. testenum_gen ( 27 ) )
@@ -141,6 +142,15 @@ func testGlobal() {
141
142
// CHECK-SIL2: } // end sil function '$s4Main10testGlobalyyF'
142
143
}
143
144
145
+ // CHECK-SIL2-LABEL: sil hidden [noinline] @$s4Main22testImplementationOnlyyyF
146
+ @inline ( never)
147
+ func testImplementationOnly( ) {
148
+ // CHECK-OUTPUT: 27
149
+ // CHECK-SIL2: function_ref @$s4Test22callImplementationOnlyyxxlF
150
+ print ( callImplementationOnly ( 27 ) )
151
+ // CHECK-SIL2: } // end sil function '$s4Main22testImplementationOnlyyyF'
152
+ }
153
+
144
154
testNestedTypes ( )
145
155
testClass ( )
146
156
testError ( )
@@ -150,4 +160,5 @@ testClosures()
150
160
testKeypath ( )
151
161
testMisc ( )
152
162
testGlobal ( )
163
+ testImplementationOnly ( )
153
164
0 commit comments