[clang] [clang][modules] Deserialize submodules lazily (PR #194968)
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Wed May 6 14:48:08 PDT 2026
================
@@ -222,6 +230,41 @@ struct ModuleAttributes {
NoUndeclaredIncludes(false) {}
};
+/// A reference to either a fully materialized Module object, or
+/// a yet-to-be-deserialized submodule in an AST file.
+class ModuleRef {
+ mutable Module *Existing = nullptr;
+ mutable ExternalSubmoduleSource *ExternalSource = nullptr;
----------------
jansvoboda11 wrote:
You're right, I think the follow-up commit changes `operator*` to not clear these, but that would increase traffic through the virtual function for later calls to `operator*`. I pushed a change that uses one bit in `ExternalSource` to signify whether it's been used to deserialize yet. This prevents calling the virtual function repeatedly, but also keeps `ExternalSource` around for use in the follow-up commit.
https://github.com/llvm/llvm-project/pull/194968
More information about the cfe-commits
mailing list