Skip to content

Commit fc225a1

Browse files
authored
Merge pull request #73014 from benlangmuir/eng/blanmuir/finclude-tree-preserve-pch-path
[Caching] Adopt -finclude-tree-preserve-pch-path to fix -gmodules with
2 parents 33581a1 + d178172 commit fc225a1

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

lib/ClangImporter/ClangModuleDependencyScanner.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ static std::vector<std::string> getClangDepScanningInvocationArguments(
124124
// ObjectFilePCHContainer and contain -gmodules debug info.
125125
commandLineArgs.push_back("-gmodules");
126126

127+
// To use -gmodules we need to have a real path for the PCH; this option has
128+
// no effect if caching is disabled.
129+
commandLineArgs.push_back("-Xclang");
130+
commandLineArgs.push_back("-finclude-tree-preserve-pch-path");
131+
127132
return commandLineArgs;
128133
}
129134

test/CAS/bridging-header.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
// CHECK-NEXT: "A"
1414
// CHECK-NEXT: ],
1515
// CHECK-NEXT: "commandLine": [
16+
// CHECK: "-fmodule-format=obj"
17+
// CHECK: "-dwarf-ext-refs"
1618
// CHECK: "-fmodule-file-cache-key",
1719
// CHECK-NEXT: "-Xcc",
1820
// CHECK-NEXT: "{{.*}}{{/|\\}}A-{{.*}}.pcm",

test/CAS/module_deps_include_tree.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,18 @@ import SubE
173173
// CHECK: "contextHash"
174174
// CHECK-SAME: "{{.*}}"
175175

176+
// CHECK: "commandLine": [
177+
// CHECK: "-fmodule-format=obj"
178+
// CHECK: "-dwarf-ext-refs"
179+
176180
/// --------Clang module B
177181
// CHECK-LABEL: "modulePath": "{{.*}}{{/|\\}}B-{{.*}}.pcm",
178182
// CHECK: "contextHash": "[[B_CONTEXT:.*]]",
179-
// CHECK: "-o"
183+
// CHECK: "commandLine": [
184+
// CHECK: "-o"
180185
// CHECK-NEXT: B-{{.*}}[[B_CONTEXT]].pcm
186+
// CHECK: "-fmodule-format=obj"
187+
// CHECK: "-dwarf-ext-refs"
181188

182189
// Check make-style dependencies
183190
// CHECK-MAKE-DEPS: module_deps_include_tree.swift

0 commit comments

Comments
 (0)