[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:47:47 PDT 2026


================
@@ -1042,6 +1046,11 @@ void ApplyHeaderSearchOptions(HeaderSearch &HS,
 void normalizeModuleCachePath(FileManager &FileMgr, StringRef Path,
                               SmallVectorImpl<char> &NormalizedPath);
 
+std::string createSpecificModuleCachePath(FileManager &FileMgr,
----------------
jansvoboda11 wrote:

Yes, the call to `getSpecificModuleCachePath()` (now `createSpecificModuleCachePath()`) is in  "clang/lib/Frontend/FrontendAction.cpp". There we don't have a `Preprocessor` or `HeaderSearch` set up yet, since we're only in the process of massaging `PreprocessorOptions`. This is why we need to compute it ourselves.

The second call is done from `HeaderSearch::initializeModuleCachePath()` which we call in "clang/lib/Frontend/CompilerInstance.cpp". I think this is indeed redundant with the first call, but I'm not 100% sure.

I personally don't mind this that much, but if we can find an elegant way to de-duplicate these calls, that'd be a good follow-up.

https://github.com/llvm/llvm-project/pull/185746


More information about the cfe-commits mailing list