From 396af1e29f7c2ab253f57569437423e5f7775959 Mon Sep 17 00:00:00 2001 From: Alberto Sartori Date: Thu, 17 Apr 2025 11:23:06 +0200 Subject: bazel_msg_factory: avoid copies in lambdas... and while there, replace `auto` with explicit signatures. --- src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp index ccc0f2d7..6c0c5ae4 100644 --- a/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp +++ b/src/buildtool/execution_api/bazel_msg/bazel_msg_factory.cpp @@ -33,6 +33,7 @@ #include "src/buildtool/common/artifact_digest_factory.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" #include "src/buildtool/file_system/git_repo.hpp" +#include "src/buildtool/file_system/object_type.hpp" #include "src/utils/cpp/hex_string.hpp" #include "src/utils/cpp/path.hpp" @@ -771,8 +772,9 @@ auto BazelMsgFactory::CreateDirectoryDigestFromLocalTree( &root, &store_file, &store_dir, - &store_symlink](auto name, auto type) { - const auto full_name = root / name; + &store_symlink](std::filesystem::path const& name, + ObjectType type) { + const auto& full_name = root / name; if (IsTreeObject(type)) { // create and store sub directory auto digest = CreateDirectoryDigestFromLocalTree( @@ -845,7 +847,8 @@ auto BazelMsgFactory::CreateGitTreeDigestFromLocalTree( &root, &store_file, &store_tree, - &store_symlink](auto name, auto type) { + &store_symlink](std::filesystem::path const& name, + ObjectType type) { const auto full_name = root / name; if (IsTreeObject(type)) { // create and store sub directory -- cgit v1.2.3