================
@@ -204,8 +204,9 @@ class FullDependencyConsumer : public DependencyConsumer {
       std::optional<P1689ModuleInfo> Provided,
       std::vector<P1689ModuleInfo> Requires) override {
     ModuleName = Provided ? Provided->ModuleName : "";
-    llvm::transform(Requires, std::back_inserter(NamedModuleDeps),
-                    [](const auto &Module) { return Module.ModuleName; });
+    llvm::transform(
+        Requires, std::back_inserter(NamedModuleDeps),
+        [](const auto &Module) -> const auto & { return Module.ModuleName; });
----------------
efriedma-quic wrote:

Ultimately, you're doing a copy either way: you're inserting a string into an 
`std::vector<std::string>`.  At best this saves a move constructor call.

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

Reply via email to