mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Dependency Scanning] Apply '-clang-scanner-module-cache-path' to header Clang module dependencies
Resolves rdar://117024665
This commit is contained in:
@@ -493,11 +493,11 @@ bool ClangImporter::addHeaderDependencies(
|
||||
std::error_code(errno, std::generic_category()));
|
||||
}
|
||||
std::string workingDir = *optionalWorkingDir;
|
||||
auto moduleCachePath = getModuleCachePathFromClang(getClangInstance());
|
||||
auto moduleOutputPath = cache.getModuleOutputPath();
|
||||
auto lookupModuleOutput =
|
||||
[moduleCachePath](const ModuleID &MID,
|
||||
ModuleOutputKind MOK) -> std::string {
|
||||
return moduleCacheRelativeLookupModuleOutput(MID, MOK, moduleCachePath);
|
||||
[moduleOutputPath](const ModuleID &MID,
|
||||
ModuleOutputKind MOK) -> std::string {
|
||||
return moduleCacheRelativeLookupModuleOutput(MID, MOK, moduleOutputPath);
|
||||
};
|
||||
auto dependencies = clangScanningTool.getTranslationUnitDependencies(
|
||||
commandLineArgs, workingDir, cache.getAlreadySeenClangModules(),
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
// RUN: %empty-directory(%t.module-cache)
|
||||
// RUN: %empty-directory(%t.scanner-cache)
|
||||
|
||||
// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t.module-cache -clang-scanner-module-cache-path %t.scanner-cache %s -o %t.deps.json -I %S/Inputs/SwiftDifferent -import-objc-header %S/Inputs/CHeaders/Bridging.h -dump-clang-diagnostics 2>&1 | %FileCheck %s --check-prefix=CHECK-CLANG-COMMAND
|
||||
// RUN: %validate-json %t.deps.json | %FileCheck %s --check-prefix=CHECK-DEPS
|
||||
|
||||
// Ensure we prefer clang scanner module cache path
|
||||
// CHECK-CLANG-COMMAND: '-fmodules-cache-path={{.*}}.scanner-cache'
|
||||
|
||||
// Ensure we the modules' output path is set to the module cache
|
||||
// CHECK-DEPS: "swift": "A"
|
||||
// CHECK-DEPS: "clang": "F"
|
||||
|
||||
// CHECK-DEPS: "clang": "F"
|
||||
// CHECK-DEPS-NEXT: },
|
||||
// CHECK-DEPS-NEXT: {
|
||||
// CHECK-DEPS-NEXT: "modulePath": "{{.*}}separate_clang_scan_cache_bridging.swift.tmp.module-cache{{/|\\\\}}F-{{.*}}.pcm"
|
||||
|
||||
// CHECK-DEPS: "swift": "A"
|
||||
// CHECK-DEPS-NEXT: },
|
||||
// CHECK-DEPS-NEXT: {
|
||||
// CHECK-DEPS-NEXT: "modulePath": "{{.*}}separate_clang_scan_cache_bridging.swift.tmp.module-cache{{/|\\\\}}A-{{.*}}.swiftmodule"
|
||||
|
||||
|
||||
|
||||
import A
|
||||
Reference in New Issue
Block a user