diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2025-02-27 12:41:59 +0100 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2025-02-28 13:44:06 +0100 |
commit | 87832d98f34cec0513e5abc14e912eec3100e975 (patch) | |
tree | bab9eb518bc356fd8bf47fe4134e877deb003de6 /src/buildtool/graph_traverser/graph_traverser.hpp | |
parent | 43ef3b3c953be338d8820e457f956bb96cd4f44d (diff) | |
download | justbuild-87832d98f34cec0513e5abc14e912eec3100e975.tar.gz |
GraphTraverser: Pass artifacts, blobs and trees to BuildAndStage by rvalue
Diffstat (limited to 'src/buildtool/graph_traverser/graph_traverser.hpp')
-rw-r--r-- | src/buildtool/graph_traverser/graph_traverser.hpp | 27 |
1 files changed, 15 insertions, 12 deletions
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<std::string, ArtifactDescription> const& artifact_descriptions, std::map<std::string, ArtifactDescription> const& runfile_descriptions, - std::vector<ActionDescription::Ptr> const& action_descriptions, - std::vector<std::string> const& blobs, - std::vector<Tree::Ptr> const& trees, + std::vector<ActionDescription::Ptr>&& action_descriptions, + std::vector<std::string>&& blobs, + std::vector<Tree::Ptr>&& trees, std::vector<ArtifactDescription>&& extra_artifacts = {}) const -> std::optional<BuildResult> { 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<DependencyGraph*> const& graph, std::map<std::string, ArtifactDescription> const& artifacts, std::map<std::string, ArtifactDescription> const& runfiles, - std::vector<ActionDescription::Ptr> const& actions, - std::vector<Tree::Ptr> const& trees, - std::vector<std::string> const& blobs, + std::vector<ActionDescription::Ptr>&& actions, + std::vector<Tree::Ptr>&& trees, + std::vector<std::string>&& blobs, std::vector<ArtifactDescription> const& extra_artifacts = {}) const -> std::optional< std::tuple<std::vector<std::filesystem::path>, |