[clang-tools-extra] [clangd] [Modules] Support Reusable Modules Builder (PR #106683)
kadir çetinkaya via cfe-commits
cfe-commits at lists.llvm.org
Sat Nov 2 08:09:02 PDT 2024
================
@@ -228,54 +223,30 @@ class StandalonePrerequisiteModules : public PrerequisiteModules {
return BuiltModuleNames.contains(ModuleName);
}
- void addModuleFile(llvm::StringRef ModuleName,
- llvm::StringRef ModuleFilePath) {
- RequiredModules.emplace_back(ModuleName, ModuleFilePath);
- BuiltModuleNames.insert(ModuleName);
+ void addModuleFile(std::shared_ptr<ModuleFile> BMI) {
+ BuiltModuleNames.insert(BMI->ModuleName);
+ RequiredModules.emplace_back(std::move(BMI));
}
private:
- llvm::SmallVector<ModuleFile, 8> RequiredModules;
+ mutable llvm::SmallVector<std::shared_ptr<ModuleFile>, 8> RequiredModules;
----------------
kadircet wrote:
why do we need to make this mutable?
also let's store a `std::shared_ptr<const ModuleFile>` instead (and update rest of the places to make sure a module file is never mutated after construction)
https://github.com/llvm/llvm-project/pull/106683
More information about the cfe-commits
mailing list