[clang-tools-extra] [clangd] [C++20] [Modules] Add scanning cache (PR #125988)

kadir çetinkaya via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 6 03:17:04 PST 2025


https://github.com/kadircet requested changes to this pull request.

instead of introducing a new concept of `ProjectModulesCache` and requiring each `ProjectModules` implementation to know about it and work with it; what about introducing a:
```cpp
class CachingProjectModules : public ProjectModules {
public:
  CachingProjectModules(GlobalCompilationDatabase &CDB);
  // Implements rest of the operations with a cache overlay.
  ...;
  // Whenever cache is invalid/empty, queries `CDB` for underlying `ProjectModules`
  // and updates/builds a cache using it.
};
```
into `ModulesBuilder.cpp` and have an instance of this in `ModulesBuilderImpl`? That way we can centralize how the caching will work and won't need to maintain multiple implementations that play with it.

As for cache validation, i think it's fine to invalidate based on file contents and whenever there's a mismatch we can query `CDB` again.

WDYT?

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


More information about the cfe-commits mailing list