[Caching] Use clang to prefix-map -fmodule-file-cache-key paths

When prefix mapping paths that are used in clang, ensure we are
consistently using the same prefix mapper from clang. This prevents
mismatches that could cause modules to fail to load.

rdar://123324072
This commit is contained in:
Ben Langmuir
2024-02-28 13:44:28 -08:00
parent d6824a7443
commit 576cc8cee1
7 changed files with 115 additions and 36 deletions

View File

@@ -39,7 +39,8 @@ using llvm::BCVBR;
/// Every .moddepcache file begins with these 4 bytes, for easy identification.
const unsigned char MODULE_DEPENDENCY_CACHE_FORMAT_SIGNATURE[] = {'I', 'M', 'D','C'};
const unsigned MODULE_DEPENDENCY_CACHE_FORMAT_VERSION_MAJOR = 5; // optionalModuleImports
const unsigned MODULE_DEPENDENCY_CACHE_FORMAT_VERSION_MAJOR =
6; // mappedPCMPath
/// Increment this on every change.
const unsigned MODULE_DEPENDENCY_CACHE_FORMAT_VERSION_MINOR = 1;
@@ -182,6 +183,7 @@ using SwiftPlaceholderModuleDetailsLayout =
using ClangModuleDetailsLayout =
BCRecordLayout<CLANG_MODULE_DETAILS_NODE, // ID
FileIDField, // pcmOutputPath
FileIDField, // mappedPCMPath
FileIDField, // moduleMapPath
ContextHashIDField, // contextHash
FlagIDArrayIDField, // commandLine