[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 13 04:37:19 PST 2025


================
@@ -449,21 +534,17 @@ llvm::Error ModulesBuilder::ModulesBuilderImpl::getOrBuildModuleFile(
 std::unique_ptr<PrerequisiteModules>
 ModulesBuilder::buildPrerequisiteModulesFor(PathRef File,
                                             const ThreadsafeFS &TFS) {
-  std::unique_ptr<ProjectModules> MDB = Impl->getCDB().getProjectModules(File);
-  if (!MDB) {
-    elog("Failed to get Project Modules information for {0}", File);
-    return std::make_unique<FailedPrerequisiteModules>();
-  }
+  ProjectModules &MDB = Impl->getCachedProjectModules();
----------------
kadircet wrote:

nit: prefer the derived type, `CachingProjectModules&`

also in the other interfaces. this should make both the code more explicit, but also enable us to add custom methods to `CachingProjectModules` and use them in the future easily.

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


More information about the cfe-commits mailing list