Skip to content

Commit 1d1c508

Browse files
[Caching] Add a testcase for clang-module-export-as
Add a test to cover the fix in clang include tree for export-as support.
1 parent bdb32c9 commit 1d1c508

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

test/CAS/clang-module-export-as.swift

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: split-file %s %t
3+
4+
// RUN: %target-swift-frontend -emit-module -module-name A_Internal -o %t/A_Internal.swiftmodule -swift-version 5 \
5+
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
6+
// RUN: -emit-module-interface-path %t/A_Internal.swiftinterface -enable-library-evolution -I %t %t/A_Internal.swift
7+
8+
// RUN: %target-swift-frontend -emit-module -module-name A -o %t/A.swiftmodule -swift-version 5 \
9+
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
10+
// RUN: -emit-module-interface-path %t/A.swiftinterface -enable-library-evolution -I %t %t/A.swift
11+
12+
// RUN: %target-swift-frontend -scan-dependencies -module-name Test -module-cache-path %t/clang-module-cache %t/main.swift \
13+
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
14+
// RUN: -o %t/deps.json -I %t -cache-compile-job -cas-path %t/cas -swift-version 5
15+
16+
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:SwiftShims > %t/shim.cmd
17+
// RUN: %swift_frontend_plain @%t/shim.cmd
18+
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:AC > %t/clangAC.cmd
19+
// RUN: %swift_frontend_plain @%t/clangAC.cmd
20+
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:A > %t/clangA.cmd
21+
// RUN: %swift_frontend_plain @%t/clangA.cmd
22+
23+
// RUN: %{python} %S/Inputs/GenerateExplicitModuleMap.py %t/deps.json > %t/map.json
24+
// RUN: llvm-cas --cas %t/cas --make-blob --data %t/map.json > %t/map.casid
25+
26+
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json Test > %t/MyApp.cmd
27+
28+
// RUN: %target-swift-frontend -emit-module -o %t/Test.swiftmodule \
29+
// RUN: -cache-compile-job -cas-path %t/cas \
30+
// RUN: -disable-implicit-swift-modules -swift-version 5 -enable-cross-import-overlays \
31+
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
32+
// RUN: -module-name Test -explicit-swift-module-map-file @%t/map.casid \
33+
// RUN: %t/main.swift @%t/MyApp.cmd
34+
35+
//--- main.swift
36+
import A
37+
38+
extension Base {
39+
func test(input: String) {
40+
Base.testA(1)
41+
}
42+
}
43+
44+
//--- A.swift
45+
@_exported import A
46+
@_implementationOnly import A_Internal
47+
public extension Base {
48+
static func testA(_ num: Int) {}
49+
fileprivate func testA(_ p: AI) {}
50+
}
51+
52+
//--- A_Internal.swift
53+
public struct AI {}
54+
55+
//--- a.h
56+
#include "ac.h"
57+
58+
//--- ac.h
59+
@interface Base
60+
- (void)test;
61+
@end
62+
63+
//--- module.modulemap
64+
module A {
65+
header "a.h"
66+
export *
67+
}
68+
69+
module AC {
70+
header "ac.h"
71+
export_as A
72+
export *
73+
}

0 commit comments

Comments
 (0)