LLVM: lib/CAS/BuiltinCAS.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
14
15using namespace llvm;
18
20void BuiltinCASContext::anchor() {}
21
24 return createStringError(std::make_error_code(std::errc::invalid_argument),
25 "invalid cas-id '" + Reference + "'");
26
27
28 if (Reference.size() != 2 * sizeof(HashType))
29 return createStringError(std::make_error_code(std::errc::invalid_argument),
30 "wrong size for cas-id hash '" + Reference + "'");
31
32 std::string Binary;
34 return createStringError(std::make_error_code(std::errc::invalid_argument),
35 "invalid hash in cas-id '" + Reference + "'");
36
40 return Digest;
41}
42
50
53 toHex(Digest, true, Hash);
55}
56
57void BuiltinCASContext::printIDImpl(raw_ostream &OS, const CASID &ID) const {
59}
60
63 return DefaultContext;
64}
65
71
76
78 if (!Handle)
79 return Handle.takeError();
80
84 Refs.push_back(Ref);
85 return Error::success();
86 }))
87 return E;
88
91 if (.getHash().equals(Hash))
93
95}
96
99#if LLVM_ENABLE_ONDISK_CAS
103#else
105#endif
106}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
AMDGPU Mark last scratch load
static StringRef getCASIDPrefix()
Definition BuiltinCAS.cpp:19
Provides a library for accessing information about this process and other processes on the operating ...
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
Error takeError()
Take ownership of the stored error.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
static HashT hashObject(const ObjectStore &CAS, ArrayRef< ObjectRef > Refs, ArrayRef< char > Data)
Unique identifier for a CAS object.
static CASID create(const CASContext *Context, StringRef Hash)
Create CASID from CASContext and raw hash bytes.
static ObjectProxy load(ObjectStore &CAS, ObjectRef Ref, ObjectHandle Node)
Reference to an object in an ObjectStore instance.
const CASContext & getContext() const
Get CASContext.
virtual std::optional< ObjectRef > getReference(const CASID &ID) const =0
Get an existing reference to the object called ID.
BuiltinCASContext()=default
static const BuiltinCASContext & getDefaultContext()
Definition BuiltinCAS.cpp:61
static Expected< HashType > parseID(StringRef PrintedDigest)
Definition BuiltinCAS.cpp:22
static void printID(ArrayRef< uint8_t > Digest, raw_ostream &OS)
Definition BuiltinCAS.cpp:51
static StringRef getHashName()
Get the name of the hash for any table identifiers.
Error createUnknownObjectError(const CASID &ID) const
Error validateObject(const CASID &ID) final
Validate the underlying object referred by CASID.
Definition BuiltinCAS.cpp:72
Expected< CASID > parseID(StringRef Reference) final
Get a CASID from a ID, which should have been generated by CASID::print().
Definition BuiltinCAS.cpp:43
Error createCorruptObjectError(const CASID &ID) const
Expected< ObjectRef > store(ArrayRef< ObjectRef > Refs, ArrayRef< char > Data) final
Store object into ObjectStore.
Definition BuiltinCAS.cpp:66
virtual Expected< ObjectRef > storeImpl(ArrayRef< uint8_t > ComputedHash, ArrayRef< ObjectRef > Refs, ArrayRef< char > Data)=0
static LLVM_ABI_FOR_TEST Expected< std::unique_ptr< UnifiedOnDiskCache > > open(StringRef Path, std::optional< uint64_t > SizeLimit, StringRef HashName, unsigned HashByteSize, OnDiskGraphDB::FaultInPolicy FaultInPolicy=OnDiskGraphDB::FaultInPolicy::FullTree)
Open a UnifiedOnDiskCache instance for a directory.
This class implements an extremely fast bulk output stream that can only output to a stream.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
decltype(HasherT::hash(std::declval< ArrayRef< uint8_t > & >())) HashType
Expected< std::unique_ptr< ondisk::UnifiedOnDiskCache > > createBuiltinUnifiedOnDiskCache(StringRef Path)
Create a UnifiedOnDiskCache instance that uses BLAKE3 hashing.
Definition BuiltinCAS.cpp:98
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
bool tryGetFromHex(StringRef Input, std::string &Output)
Convert hexadecimal string Input to its binary representation and store the result in Output....
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
@ Ref
The access may reference the value stored in memory.
FunctionAddr VTableAddr uintptr_t uintptr_t Data
OutputIt copy(R &&Range, OutputIt Out)
void toHex(ArrayRef< uint8_t > Input, bool LowerCase, SmallVectorImpl< char > &Output)
Convert buffer Input to its hexadecimal representation. The returned string is double the size of Inp...
StringRef toStringRef(bool B)
Construct a string ref from a boolean.