Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions lib/DependencyScan/ScanDependencies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,12 @@ class ExplicitModuleDependencyResolver {
auto &dep = cache.findKnownDependency(bridgingDep);
auto *clangDep = dep.getAsClangModule();
assert(clangDep && "wrong module dependency kind");
auto pcmPath = llvm::sys::path::filename(clangDep->mappedPCMPath).str();
if (!clangDep->moduleCacheKey.empty()) {
bridgingHeaderBuildCmd.push_back("-Xcc");
bridgingHeaderBuildCmd.push_back("-fmodule-file-cache-key");
bridgingHeaderBuildCmd.push_back("-Xcc");
bridgingHeaderBuildCmd.push_back(clangDep->mappedPCMPath);
bridgingHeaderBuildCmd.push_back(pcmPath);
bridgingHeaderBuildCmd.push_back("-Xcc");
bridgingHeaderBuildCmd.push_back(clangDep->moduleCacheKey);
}
Expand Down Expand Up @@ -277,17 +278,21 @@ class ExplicitModuleDependencyResolver {
bool handleClangModuleDependency(
ModuleDependencyID depModuleID,
const ClangModuleDependencyStorage &clangDepDetails) {
auto pcmPath =
clangDepDetails.moduleCacheKey.empty()
? clangDepDetails.mappedPCMPath
: llvm::sys::path::filename(clangDepDetails.mappedPCMPath).str();
if (!resolvingDepInfo.isSwiftSourceModule()) {
if (!resolvingDepInfo.isClangModule()) {
commandline.push_back("-Xcc");
commandline.push_back("-fmodule-file=" + depModuleID.ModuleName + "=" +
clangDepDetails.mappedPCMPath);
pcmPath);
}
if (!clangDepDetails.moduleCacheKey.empty()) {
commandline.push_back("-Xcc");
commandline.push_back("-fmodule-file-cache-key");
commandline.push_back("-Xcc");
commandline.push_back(clangDepDetails.mappedPCMPath);
commandline.push_back(pcmPath);
commandline.push_back("-Xcc");
commandline.push_back(clangDepDetails.moduleCacheKey);
}
Expand Down
18 changes: 9 additions & 9 deletions lib/IRGen/IRGenDebugInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -929,10 +929,10 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
// Note: The implementation here assumes that all clang submodules
// belong to the same PCM file.
ASTSourceDescriptor ParentDescriptor(*ClangModule->Parent);
Parent = getOrCreateModule({ParentDescriptor.getModuleName(),
ParentDescriptor.getPath(),
Desc.getASTFile(), Desc.getSignature()},
ClangModule->Parent);
Parent = getOrCreateModule(
{ParentDescriptor.getModuleName(), ParentDescriptor.getPath(),
Desc.getASTFile(), Desc.getSignature(), /*CASID=*/""},
ClangModule->Parent);
}
return getOrCreateModule(ClangModule, Parent, Desc.getModuleName(),
IncludePath, Signature, Desc.getASTFile());
Expand Down Expand Up @@ -2594,11 +2594,11 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
// Describe the submodule, but substitute the cached ASTFile from
// the toplevel module. The ASTFile pointer in SubModule may be
// dangling and cant be trusted.
Scope = getOrCreateModule({SubModuleDesc->getModuleName(),
SubModuleDesc->getPath(),
TopLevelModuleDesc->getASTFile(),
TopLevelModuleDesc->getSignature()},
SubModuleDesc->getModuleOrNull());
Scope = getOrCreateModule(
{SubModuleDesc->getModuleName(), SubModuleDesc->getPath(),
TopLevelModuleDesc->getASTFile(),
TopLevelModuleDesc->getSignature(), /*CASID=*/""},
SubModuleDesc->getModuleOrNull());
else if (SubModuleDesc->getModuleOrNull() == nullptr)
// This is (bridging header) PCH.
Scope = getOrCreateModule(*SubModuleDesc, nullptr);
Expand Down
4 changes: 2 additions & 2 deletions test/CAS/bridging-header.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
// CHECK: "-dwarf-ext-refs"
// CHECK: "-fmodule-file-cache-key",
// CHECK-NEXT: "-Xcc",
// CHECK-NEXT: "{{.*}}{{/|\\}}A-{{.*}}.pcm",
// CHECK-NEXT: "A-{{.*}}.pcm",
// CHECK-NEXT: "-Xcc",
// CHECK-NEXT: "llvmcas://{{.*}}",
// CHECK-NEXT: "-Xcc",
// CHECK-NEXT: "-fmodule-file-cache-key",
// CHECK-NEXT: "-Xcc",
// CHECK-NEXT: "{{.*}}{{/|\\}}B-{{.*}}.pcm",
// CHECK-NEXT: "B-{{.*}}.pcm",
// CHECK-NEXT: "-Xcc",
// CHECK-NEXT: "llvmcas://{{.*}}"

Expand Down
3 changes: 1 addition & 2 deletions test/CAS/debug_info_pcm.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

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

// CHECK: DW_AT_GNU_dwo_name
// CHECK-SAME: TMP_DIR
// CHECK: DW_AT_GNU_dwo_name ("llvmcas://{{.*}}")

//--- test.swift
import A
Expand Down
4 changes: 2 additions & 2 deletions test/CAS/module_path_remap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
// DEPS-FS: /^src/test/CAS/module_path_remap.swift

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

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

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

// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json clang:F clangIncludeTree > %t/tree.casid
// RUN: clang-cas-test --cas %t/cas --print-include-tree @%t/tree.casid | %FileCheck %s -check-prefix TREE
Expand Down
2 changes: 1 addition & 1 deletion test/ScanDependencies/clang_module_output_symlink.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// Check the contents of the JSON output
// RUN: %validate-json %t/deps.json | %FileCheck %s

// CHECK: "-fmodule-file=C=[[PCM_PATH:.*symlink.*C-.*.pcm]]"
// CHECK: "-fmodule-file=C=[[PCM_PATH:C-.*.pcm]]"
// CHECK: "-fmodule-file-cache-key"
// CHECK-NEXT: "-Xcc"
// CHECK-NEXT: "[[PCM_PATH]]"
Expand Down