File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -254,6 +254,20 @@ void ClangImporter::recordModuleDependencies(
254
254
swiftArgs.push_back (" -module-name" );
255
255
swiftArgs.push_back (clangModuleDep.ModuleName );
256
256
257
+ // Pass down search paths to the -emit-module action.
258
+ // Unlike building Swift modules, we need to include all search paths to
259
+ // the clang invocation to build PCMs because transitive headers can only
260
+ // be found via search paths. Passing these headers as explicit inputs can
261
+ // be quite challenging.
262
+ for (auto &path: Impl.SwiftContext .SearchPathOpts .ImportSearchPaths ) {
263
+ swiftArgs.push_back (" -I" );
264
+ swiftArgs.push_back (path);
265
+ }
266
+ for (auto &path: Impl.SwiftContext .SearchPathOpts .FrameworkSearchPaths ) {
267
+ swiftArgs.push_back (path.IsSystem ? " -Fsystem" : " -F" );
268
+ swiftArgs.push_back (path.Path );
269
+ }
270
+
257
271
// Swift frontend option for input file path (Foo.modulemap).
258
272
swiftArgs.push_back (clangModuleDep.ClangModuleMapFile );
259
273
// Module-level dependencies.
Original file line number Diff line number Diff line change 28
28
// CHECK-PCM-NEXT: },
29
29
// CHECK-PCM-NEXT: {
30
30
// CHECK-PCM-NEXT: "modulePath": "F.pcm",
31
+ // CHECK-PCM: "-I"
31
32
32
33
// CHECK-SWIFT: {
33
34
// CHECK-SWIFT-NEXT: "mainModuleName": "F",
Original file line number Diff line number Diff line change @@ -195,9 +195,7 @@ import SubE
195
195
/// --------Clang module SwiftShims
196
196
// CHECK-LABEL: "modulePath": "SwiftShims.pcm",
197
197
198
- // CHECK-NO-SEARCH-PATHS-NOT: "-I"
199
198
// CHECK-NO-SEARCH-PATHS-NOT: "-sdk"
200
- // CHECK-NO-SEARCH-PATHS-NOT: "-F"
201
199
// CHECK-NO-SEARCH-PATHS-NOT: "-prebuilt-module-cache-path"
202
200
203
201
// Check make-style dependencies
You can’t perform that action at this time.
0 commit comments