================
@@ -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:

> I add the data members of ModuleFile  to be private and we can only access 
> them by the getters. I think this has the same effect.

i don't think it has the same affect. It makes sure code today is adhering to 
those standards because you and me have context and very careful about the 
interaction. Tomorrow someone might end up mutating ModuleFiles because the 
interfaces in builder didn't enforce that and they didn't pay as much attention 
to subtle shared ownership model.

https://github.com/llvm/llvm-project/pull/106683
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to