9#ifndef LLVM_CAS_BUILTINOBJECTHASHER_H
10#define LLVM_CAS_BUILTINOBJECTHASHER_H
18template <
class HasherT>
class BuiltinObjectHasher {
24 BuiltinObjectHasher
H;
25 H.updateSize(Refs.
size());
27 H.updateRef(CAS,
Ref);
34 BuiltinObjectHasher
H;
35 H.updateSize(Refs.size());
45 HashT finish() {
return Hasher.final(); }
47 void updateRef(
const ObjectStore &CAS, ObjectRef
Ref) {
48 updateID(CAS.getID(
Ref));
51 void updateID(
const CASID &
ID) { updateID(
ID.getHash()); }
53 void updateID(ArrayRef<uint8_t> Hash) {
57 "Expected object ref to match the hash size");
61 void updateArray(ArrayRef<uint8_t> Bytes) {
62 updateSize(Bytes.size());
66 void updateArray(ArrayRef<char> Bytes) {
67 updateArray(
ArrayRef(
reinterpret_cast<const uint8_t *
>(Bytes.data()),
71 void updateSize(uint64_t
Size) {
77 BuiltinObjectHasher() =
default;
78 ~BuiltinObjectHasher() =
default;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file contains the declaration of the ObjectStore class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
Tagged union holding either a T or a Error.
StringRef - Represent a constant reference to a string, i.e.
static HashT hashObject(const ObjectStore &CAS, ArrayRef< ObjectRef > Refs, ArrayRef< char > Data)
static Expected< HashT > hashFile(StringRef FilePath)
static HashT hashObject(ArrayRef< ArrayRef< uint8_t > > Refs, ArrayRef< char > Data)
decltype(HasherT::hash(std::declval< ArrayRef< uint8_t > & >())) HashT
Reference to an object in an ObjectStore instance.
Content-addressable storage for objects.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
BLAKE3 HasherT
Current hash type for the builtin CAS.
value_type byte_swap(value_type value, endianness endian)
@ Ref
The access may reference the value stored in memory.
FunctionAddr VTableAddr uintptr_t uintptr_t Data
ArrayRef(const T &OneElt) -> ArrayRef< T >