9#ifndef LLVM_CAS_BUILTINOBJECTHASHER_H
10#define LLVM_CAS_BUILTINOBJECTHASHER_H
19template <
class HasherT>
class BuiltinObjectHasher {
25 BuiltinObjectHasher
H;
26 H.updateSize(Refs.
size());
28 H.updateRef(CAS,
Ref);
35 BuiltinObjectHasher
H;
36 H.updateSize(Refs.size());
46 HashT finish() {
return Hasher.final(); }
48 void updateRef(
const ObjectStore &CAS, ObjectRef
Ref) {
49 updateID(CAS.getID(
Ref));
52 void updateID(
const CASID &ID) { updateID(ID.getHash()); }
54 void updateID(ArrayRef<uint8_t> Hash) {
58 "Expected object ref to match the hash size");
62 void updateArray(ArrayRef<uint8_t> Bytes) {
63 updateSize(Bytes.size());
67 void updateArray(ArrayRef<char> Bytes) {
68 updateArray(
ArrayRef(
reinterpret_cast<const uint8_t *
>(Bytes.data()),
78 BuiltinObjectHasher() =
default;
79 ~BuiltinObjectHasher() =
default;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define LLVM_TEMPLATE_ABI
This file contains the declaration of the ObjectStore class.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
Get the array size.
Tagged union holding either a T or a Error.
Represent a constant reference to a string, i.e.
Hasher for stored objects in builtin CAS.
static HashT hashObject(const ObjectStore &CAS, ArrayRef< ObjectRef > Refs, ArrayRef< char > Data)
static HashT hashObject(ArrayRef< ArrayRef< uint8_t > > Refs, ArrayRef< char > Data)
static Expected< HashT > hashFile(StringRef FilePath)
decltype(HasherT::hash(std::declval< ArrayRef< uint8_t > & >())) HashT
Reference to an object in an ObjectStore instance.
Content-addressable storage for objects.
BLAKE3 HasherT
Current hash type for the builtin CAS.
value_type byte_swap(value_type value, endianness endian)
Swap the bytes of value to match the given endianness.
@ Ref
The access may reference the value stored in memory.
ArrayRef(const T &OneElt) -> ArrayRef< T >