Skip to content

Commit 2fc05b7

Browse files
Update swift compiler after clang gmodule CAS build update
Fix swift compiler build and test to work with new clang gmodule build with CAS, which encodes references to clang PCMs as CASIDs.
1 parent 1cf8d2e commit 2fc05b7

File tree

5 files changed

+20
-18
lines changed

5 files changed

+20
-18
lines changed

lib/DependencyScan/ScanDependencies.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ class ExplicitModuleDependencyResolver {
147147
bridgingHeaderBuildCmd.push_back("-Xcc");
148148
bridgingHeaderBuildCmd.push_back("-fmodule-file-cache-key");
149149
bridgingHeaderBuildCmd.push_back("-Xcc");
150-
bridgingHeaderBuildCmd.push_back(clangDep->mappedPCMPath);
150+
bridgingHeaderBuildCmd.push_back(
151+
llvm::sys::path::filename(clangDep->mappedPCMPath).str());
151152
bridgingHeaderBuildCmd.push_back("-Xcc");
152153
bridgingHeaderBuildCmd.push_back(clangDep->moduleCacheKey);
153154
}
@@ -277,17 +278,19 @@ class ExplicitModuleDependencyResolver {
277278
bool handleClangModuleDependency(
278279
ModuleDependencyID depModuleID,
279280
const ClangModuleDependencyStorage &clangDepDetails) {
281+
auto pcmPath =
282+
llvm::sys::path::filename(clangDepDetails.mappedPCMPath).str();
280283
if (!resolvingDepInfo.isSwiftSourceModule()) {
281284
if (!resolvingDepInfo.isClangModule()) {
282285
commandline.push_back("-Xcc");
283286
commandline.push_back("-fmodule-file=" + depModuleID.ModuleName + "=" +
284-
clangDepDetails.mappedPCMPath);
287+
pcmPath);
285288
}
286289
if (!clangDepDetails.moduleCacheKey.empty()) {
287290
commandline.push_back("-Xcc");
288291
commandline.push_back("-fmodule-file-cache-key");
289292
commandline.push_back("-Xcc");
290-
commandline.push_back(clangDepDetails.mappedPCMPath);
293+
commandline.push_back(pcmPath);
291294
commandline.push_back("-Xcc");
292295
commandline.push_back(clangDepDetails.moduleCacheKey);
293296
}

lib/IRGen/IRGenDebugInfo.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -929,10 +929,10 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
929929
// Note: The implementation here assumes that all clang submodules
930930
// belong to the same PCM file.
931931
ASTSourceDescriptor ParentDescriptor(*ClangModule->Parent);
932-
Parent = getOrCreateModule({ParentDescriptor.getModuleName(),
933-
ParentDescriptor.getPath(),
934-
Desc.getASTFile(), Desc.getSignature()},
935-
ClangModule->Parent);
932+
Parent = getOrCreateModule(
933+
{ParentDescriptor.getModuleName(), ParentDescriptor.getPath(),
934+
Desc.getASTFile(), Desc.getSignature(), /*CASID=*/""},
935+
ClangModule->Parent);
936936
}
937937
return getOrCreateModule(ClangModule, Parent, Desc.getModuleName(),
938938
IncludePath, Signature, Desc.getASTFile());
@@ -2594,11 +2594,11 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
25942594
// Describe the submodule, but substitute the cached ASTFile from
25952595
// the toplevel module. The ASTFile pointer in SubModule may be
25962596
// dangling and cant be trusted.
2597-
Scope = getOrCreateModule({SubModuleDesc->getModuleName(),
2598-
SubModuleDesc->getPath(),
2599-
TopLevelModuleDesc->getASTFile(),
2600-
TopLevelModuleDesc->getSignature()},
2601-
SubModuleDesc->getModuleOrNull());
2597+
Scope = getOrCreateModule(
2598+
{SubModuleDesc->getModuleName(), SubModuleDesc->getPath(),
2599+
TopLevelModuleDesc->getASTFile(),
2600+
TopLevelModuleDesc->getSignature(), /*CASID=*/""},
2601+
SubModuleDesc->getModuleOrNull());
26022602
else if (SubModuleDesc->getModuleOrNull() == nullptr)
26032603
// This is (bridging header) PCH.
26042604
Scope = getOrCreateModule(*SubModuleDesc, nullptr);

test/CAS/bridging-header.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
// CHECK: "-dwarf-ext-refs"
1919
// CHECK: "-fmodule-file-cache-key",
2020
// CHECK-NEXT: "-Xcc",
21-
// CHECK-NEXT: "{{.*}}{{/|\\}}A-{{.*}}.pcm",
21+
// CHECK-NEXT: "A-{{.*}}.pcm",
2222
// CHECK-NEXT: "-Xcc",
2323
// CHECK-NEXT: "llvmcas://{{.*}}",
2424
// CHECK-NEXT: "-Xcc",
2525
// CHECK-NEXT: "-fmodule-file-cache-key",
2626
// CHECK-NEXT: "-Xcc",
27-
// CHECK-NEXT: "{{.*}}{{/|\\}}B-{{.*}}.pcm",
27+
// CHECK-NEXT: "B-{{.*}}.pcm",
2828
// CHECK-NEXT: "-Xcc",
2929
// CHECK-NEXT: "llvmcas://{{.*}}"
3030

test/CAS/debug_info_pcm.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616

1717
// RUN: dwarfdump --debug-info @%t/A.path | %FileCheck %s
1818

19-
// CHECK: DW_AT_GNU_dwo_name
20-
// CHECK-SAME: TMP_DIR
19+
// CHECK: DW_AT_GNU_dwo_name ("llvmcas://{{.*}}")
2120

2221
//--- test.swift
2322
import A

test/CAS/module_path_remap.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
// DEPS-FS: /^src/test/CAS/module_path_remap.swift
1515

1616
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json deps bridgingHeader | %FileCheck %s -check-prefix DEPS-BRIDGING
17-
// DEPS-BRIDGING: -fmodule-file=F=/^tmp/clang-module-cache/F-{{.*}}.pcm
17+
// DEPS-BRIDGING: -fmodule-file=F=F-{{.*}}.pcm
1818

1919
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json F casFSRootID > %t/F.fs.casid
2020
// RUN: %cache-tool -cas-path %t/cas -cache-tool-action print-include-tree-list @%t/F.fs.casid | %FileCheck %s -check-prefix F-FS
2121
// F-FS: /^src/test/CAS/../ScanDependencies/Inputs/Swift/F.swiftinterface
2222

2323
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json F commandLine | %FileCheck %s -check-prefix F-CMD
2424
// F-CMD: /^src/test/CAS/../ScanDependencies/Inputs/Swift/F.swiftinterface
25-
// F-CMD: -fmodule-file=SwiftShims=/^tmp/clang-module-cache/SwiftShims-{{.*}}.pcm
25+
// F-CMD: -fmodule-file=SwiftShims=SwiftShims-{{.*}}.pcm
2626

2727
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json clang:F clangIncludeTree > %t/tree.casid
2828
// RUN: clang-cas-test --cas %t/cas --print-include-tree @%t/tree.casid | %FileCheck %s -check-prefix TREE

0 commit comments

Comments
 (0)