diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-08-29 11:55:07 +0200 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-08-30 17:17:09 +0200 |
commit | 3a771602f8ee6c7940208d447463061aa9b6af8c (patch) | |
tree | 491e86926da47d9365a49a3ecdd35dbcd48c1364 /src/buildtool/common/artifact_digest.hpp | |
parent | 60daf819bbe7db97064c7e102acedbf3cd693410 (diff) | |
download | justbuild-3a771602f8ee6c7940208d447463061aa9b6af8c.tar.gz |
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.
Diffstat (limited to 'src/buildtool/common/artifact_digest.hpp')
-rw-r--r-- | src/buildtool/common/artifact_digest.hpp | 9 |
1 files changed, 4 insertions, 5 deletions
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<ArtifactDigest>; - +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<ArtifactDigest> { [[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; } }; |