[clang] [clang] Expose normalized module cache path in `HeaderSearch` (PR #185746)
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 11 20:53:34 PDT 2026
================
@@ -467,20 +471,20 @@ class HeaderSearch {
return {};
}
- /// Set the context hash to use for module cache paths.
- void setContextHash(StringRef Hash) { ContextHash = std::string(Hash); }
+ /// Initialize the module cache path.
+ void initializeModuleCachePath(std::string ContextHash);
- /// Set the module cache path with the context hash (unless suppressed).
- void setSpecificModuleCachePath(StringRef Path) {
- SpecificModuleCachePath = std::string(Path);
+ /// Retrieve the module cache path with the context hash (unless suppressed).
+ StringRef getSpecificModuleCachePath() const {
+ return SpecificModuleCachePath;
}
/// Retrieve the context hash.
StringRef getContextHash() const { return ContextHash; }
- /// Retrieve the module cache path with the context hash (unless suppressed).
- StringRef getSpecificModuleCachePath() const {
- return SpecificModuleCachePath;
+ /// Retrieve the normalized module cache path.
+ StringRef getNormalizedModuleCachePath() const {
----------------
jansvoboda11 wrote:
Normalized module cache path is `X` from `-fmodules-cache-path=X` that was made absolute, and with `llvm::sys::path::remove_dots()` applied. I believe this is done mainly so that the `IMPORT` statements in PCM files contain absolute paths, making it possible to load transitively PCMs regardless of the importer CWD.
Specific module cache path is the normalized module cache path with the context hash appended as a subdirectory (unless suppressed by `-fdisable-module-hash`). This is (somewhat poorly) documented in the `HeaderSearch` member.
https://github.com/llvm/llvm-project/pull/185746
More information about the cfe-commits
mailing list