From 3a771602f8ee6c7940208d447463061aa9b6af8c Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Thu, 29 Aug 2024 11:55:07 +0200 Subject: Return the IsTree flag from ArtifactDigest ...and replace obvious redundant conversions to bazel_re::Digest, which were done to ensure that the digest represents a tree. --- src/buildtool/common/artifact_digest.hpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/buildtool/common/artifact_digest.hpp') diff --git a/src/buildtool/common/artifact_digest.hpp b/src/buildtool/common/artifact_digest.hpp index 6b9ecb88..987e654a 100644 --- a/src/buildtool/common/artifact_digest.hpp +++ b/src/buildtool/common/artifact_digest.hpp @@ -32,9 +32,7 @@ // unprefixed hex string as hash. For communication with the execution API it // can be cast to bazel_re::Digest which is the wire format that contains // prefixed hashes in native mode. -class ArtifactDigest { - friend struct std::hash; - +class ArtifactDigest final { public: ArtifactDigest() noexcept = default; @@ -63,6 +61,7 @@ class ArtifactDigest { } [[nodiscard]] auto size() const noexcept -> std::size_t { return size_; } + [[nodiscard]] auto IsTree() const noexcept -> bool { return is_tree_; } // NOLINTNEXTLINE allow implicit casts [[nodiscard]] operator bazel_re::Digest() const { @@ -134,8 +133,8 @@ struct hash { [[nodiscard]] auto operator()(ArtifactDigest const& digest) const noexcept -> std::size_t { std::size_t seed{}; - hash_combine(&seed, digest.hash_); - hash_combine(&seed, digest.is_tree_); + hash_combine(&seed, digest.hash()); + hash_combine(&seed, digest.IsTree()); return seed; } }; -- cgit v1.2.3