From 87832d98f34cec0513e5abc14e912eec3100e975 Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Thu, 27 Feb 2025 12:41:59 +0100 Subject: GraphTraverser: Pass artifacts, blobs and trees to BuildAndStage by rvalue --- src/buildtool/graph_traverser/graph_traverser.hpp | 27 +++++++++++++---------- 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'src/buildtool/graph_traverser/graph_traverser.hpp') diff --git a/src/buildtool/graph_traverser/graph_traverser.hpp b/src/buildtool/graph_traverser/graph_traverser.hpp index 5d240cd6..9dc32b61 100644 --- a/src/buildtool/graph_traverser/graph_traverser.hpp +++ b/src/buildtool/graph_traverser/graph_traverser.hpp @@ -114,18 +114,18 @@ class GraphTraverser { [[nodiscard]] auto BuildAndStage( std::map const& artifact_descriptions, std::map const& runfile_descriptions, - std::vector const& action_descriptions, - std::vector const& blobs, - std::vector const& trees, + std::vector&& action_descriptions, + std::vector&& blobs, + std::vector&& trees, std::vector&& extra_artifacts = {}) const -> std::optional { DependencyGraph graph; // must outlive artifact_nodes auto artifacts = BuildArtifacts(&graph, artifact_descriptions, runfile_descriptions, - action_descriptions, - trees, - blobs, + std::move(action_descriptions), + std::move(trees), + std::move(blobs), extra_artifacts); if (not artifacts) { return std::nullopt; @@ -211,7 +211,7 @@ class GraphTraverser { if (not desc) { return std::nullopt; } - auto const [blobs, tree_descs, actions] = *desc; + auto [blobs, tree_descs, actions] = *std::move(desc); HashFunction::Type const hash_type = context_.apis->local->GetHashType(); @@ -245,8 +245,11 @@ class GraphTraverser { artifact_descriptions.emplace(rel_path, std::move(*artifact)); } - return BuildAndStage( - artifact_descriptions, {}, action_descriptions, blobs, trees); + return BuildAndStage(artifact_descriptions, + {}, + std::move(action_descriptions), + std::move(blobs), + std::move(trees)); } private: @@ -496,9 +499,9 @@ class GraphTraverser { gsl::not_null const& graph, std::map const& artifacts, std::map const& runfiles, - std::vector const& actions, - std::vector const& trees, - std::vector const& blobs, + std::vector&& actions, + std::vector&& trees, + std::vector&& blobs, std::vector const& extra_artifacts = {}) const -> std::optional< std::tuple, -- cgit v1.2.3