[clang] [clang] Extract in-memory module cache writes from `ASTWriter` (PR #190062)
Cyndy Ishida via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 3 09:33:03 PDT 2026
================
@@ -1488,6 +1488,18 @@ static bool compileModuleImpl(CompilerInstance &ImportingInstance,
ImportingInstance.getModuleCache().updateModuleTimestamp(ModuleFileName);
}
+ // This isn't strictly necessary, but it's more efficient to extract the AST
+ // file (which may be wrapped in an object file) now rather than doing so
+ // repeatedly in the readers.
+ const PCHContainerReader &Rdr = ImportingInstance.getPCHContainerReader();
+ StringRef ExtractedBuffer = Rdr.ExtractPCH(*Buffer);
----------------
cyndyishida wrote:
A patch to find/replace `PCHContainerReader` with e.g. `ASTFileContainerReader` and `ExtractPCH` to `ExtractASTFile`. It's yet another place where the code reads in a different way than what it is actually doing. For example, it took me a little longer to reason about the relationship of the `ModuleFileName` and `Buffer` in this diff because it wasn't obvious that `ExtractPCH` isn't strictly for PCHs. The interaction between `ExtractPCH` & `addBuiltPCM` also takes some more work to reason about.
https://github.com/llvm/llvm-project/pull/190062
More information about the cfe-commits
mailing list