[clang-tools-extra] [clangd] [Modules] Support Reusable Modules Builder (PR #106683)

kadir çetinkaya via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 28 05:08:51 PDT 2024


================
@@ -85,19 +85,20 @@ class PrerequisiteModules {
 /// different versions and different source files.
 class ModulesBuilder {
 public:
-  ModulesBuilder(const GlobalCompilationDatabase &CDB) : CDB(CDB) {}
+  ModulesBuilder() = default;
+  virtual ~ModulesBuilder() = default;
 
   ModulesBuilder(const ModulesBuilder &) = delete;
   ModulesBuilder(ModulesBuilder &&) = delete;
 
   ModulesBuilder &operator=(const ModulesBuilder &) = delete;
   ModulesBuilder &operator=(ModulesBuilder &&) = delete;
 
-  std::unique_ptr<PrerequisiteModules>
-  buildPrerequisiteModulesFor(PathRef File, const ThreadsafeFS &TFS) const;
+  virtual std::unique_ptr<PrerequisiteModules>
----------------
kadircet wrote:

>Since I want to avoid introducing the complex date members for ReusableModulesBuilder into the header file. I feel the current codes may be more neat. 

I totally agree with that. I think the recommendations in the rest of the comments mitigates this concern. Especially the one around just declaring a caching-class as an implementation detail and not polluting the header with any other details.

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


More information about the cfe-commits mailing list