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(
254254 swiftArgs.push_back (" -module-name" );
255255 swiftArgs.push_back (clangModuleDep.ModuleName );
256256
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+
257271 // Swift frontend option for input file path (Foo.modulemap).
258272 swiftArgs.push_back (clangModuleDep.ClangModuleMapFile );
259273 // Module-level dependencies.
Original file line number Diff line number Diff line change 2828// CHECK-PCM-NEXT: },
2929// CHECK-PCM-NEXT: {
3030// CHECK-PCM-NEXT: "modulePath": "F.pcm",
31+ // CHECK-PCM: "-I"
3132
3233// CHECK-SWIFT: {
3334// CHECK-SWIFT-NEXT: "mainModuleName": "F",
Original file line number Diff line number Diff line change @@ -195,9 +195,7 @@ import SubE
195195/// --------Clang module SwiftShims
196196// CHECK-LABEL: "modulePath": "SwiftShims.pcm",
197197
198- // CHECK-NO-SEARCH-PATHS-NOT: "-I"
199198// CHECK-NO-SEARCH-PATHS-NOT: "-sdk"
200- // CHECK-NO-SEARCH-PATHS-NOT: "-F"
201199// CHECK-NO-SEARCH-PATHS-NOT: "-prebuilt-module-cache-path"
202200
203201// Check make-style dependencies
You can’t perform that action at this time.
0 commit comments