llvm-project
f68d44dc - [clang][modules] Deserialize submodules lazily (#194968)

Commit
14 days ago
[clang][modules] Deserialize submodules lazily (#194968) This PR implements on-demand deserialization of `Module` objects from PCM files. This is motivated by dependency scanning, where eager deserialization of submodules turns out to be very expensive and typically unnecessary. The core of this patch is the introduction of `ModuleRef`, which may either be a pointer to `Module`, a pointer to new `ExternalSubmoduleSource` (implemented by `ASTReader`) and `serialization::SubmoduleID`, both, or none (null). Dereferencing `ModuleRef` ensures the `Module` is deserialized if possible. This replaces `ASTReader::UnresolvedModuleRefs` and changes the structure of a PCM file a bit, most importantly introducing new `SUBMODULE_CHILD` record that enables hooking up the laziness into the qualified by-name lookup that uses `Module::SubModuleIndex`. This speeds up dependency scanning by ~5.5%.
Author
Parents
Loading