1+ // REQUIRES: objc_interop
12// RUN: %empty-directory(%t)
23// RUN: split-file %s %t
34
6465// RUN: %target-swift-frontend -cache-compile-job -module-name Test -O -cas-path %t/cas @%t/MyApp.cmd %t/test.swift \
6566// RUN: -emit-module -o %t/Test.swiftmodule
6667
68+ /// Importing binary module with bridging header built from CAS from a regluar build.
69+ /// This should succeed even it is also importing a bridging header that shares same header dependencies (with proper header guard).
6770// RUN: %target-swift-frontend -typecheck -module-name User -swift-version 5 \
6871// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
6972// RUN: -Xcc -fmodule-map-file=%t/a.modulemap -Xcc -fmodule-map-file=%t/b.modulemap \
70- // RUN: -I %t %t/user.swift
73+ // RUN: -I %t %t/user.swift -import-objc-header %t/Bridging2.h
74+
75+ /// Importing binary module with bridging header built from CAS from a cached build. This should work without additional bridging header deps.
76+ // RUN: %target-swift-frontend -scan-dependencies -module-name User -module-cache-path %t/clang-module-cache -O \
77+ // RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
78+ // RUN: %t/user.swift -o %t/deps2.json -swift-version 5 -cache-compile-job -cas-path %t/cas \
79+ // RUN: -Xcc -fmodule-map-file=%t/a.modulemap -Xcc -fmodule-map-file=%t/b.modulemap -I %t
80+
81+ // RUN: %{python} %S/Inputs/GenerateExplicitModuleMap.py %t/deps2.json > %t/map2.json
82+ // RUN: llvm-cas --cas %t/cas --make-blob --data %t/map2.json > %t/map2.casid
83+ // RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps2.json User > %t/User.cmd
84+ // RUN: %target-swift-frontend -cache-compile-job -module-name User -O -cas-path %t/cas \
85+ // RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import -disable-implicit-swift-modules \
86+ // RUN: -explicit-swift-module-map-file @%t/map2.casid @%t/User.cmd %t/user.swift \
87+ // RUN: -emit-module -o %t/User.swiftmodule
7188
7289//--- test.swift
73- import B
7490public func test( ) {
7591 b ( )
7692}
@@ -84,14 +100,31 @@ func user() {
84100 test ( )
85101}
86102
103+ extension A {
104+ public func testA( ) { }
105+ }
106+
107+
87108//--- Bridging.h
88109#include " Foo.h "
110+ #include " Foo2.h "
111+
112+ //--- Bridging2.h
113+ #include " Foo.h "
114+ #include " Foo2.h "
89115
90116//--- Foo.h
91117#import " a.h "
92118
119+ //--- Foo2.h
120+ #pragma once
121+ int Foo = 0 ;
122+
93123//--- a.h
94124#include " b.h "
125+ struct A {
126+ int a;
127+ } ;
95128
96129//--- b.h
97130void b( void) ;
0 commit comments