22 ArrayRef<uint8_t> &Buffer)
override {
26 ArrayRef<uint8_t> &Buffer)
override {
27 return BBS.readLongestContiguousChunk(
Offset, Buffer);
29 uint64_t getLength()
override {
return BBS.getLength(); }
37 MutableArrayRefImpl(MutableArrayRef<uint8_t>
Data,
endianness Endian)
38 : BBS(
Data, Endian) {}
43 ArrayRef<uint8_t> &Buffer)
override {
47 ArrayRef<uint8_t> &Buffer)
override {
48 return BBS.readLongestContiguousChunk(
Offset, Buffer);
50 uint64_t getLength()
override {
return BBS.getLength(); }
55 Error commit()
override {
return BBS.commit(); }
58 MutableBinaryByteStream BBS;
65 std::optional<uint64_t>
Length)
92 if (Buffer.
size() > MaxLength)
93 Buffer = Buffer.
slice(0, MaxLength);
102 std::optional<uint64_t>
Length)
112 if (
auto EC = checkOffsetForWrite(
Offset,
Data.size()))
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
ArrayRef< T > slice(size_t N, size_t M) const
slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array.
std::optional< uint64_t > Length
BinaryStreamRefBase()=default
BinaryStream * BorrowedImpl
Error checkOffsetForRead(uint64_t Offset, uint64_t DataSize) const
uint64_t getLength() const
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
LLVM_ABI Error readLongestContiguousChunk(uint64_t Offset, ArrayRef< uint8_t > &Buffer) const
Given an Offset into this BinaryStreamRef, return a reference to the largest buffer the stream could ...
LLVM_ABI Error readBytes(uint64_t Offset, uint64_t Size, ArrayRef< uint8_t > &Buffer) const
Given an Offset into this StreamRef and a Size, return a reference to a buffer owned by the stream.
BinaryStreamRef()=default
An interface for accessing data in a stream-like format, but which discourages copying.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
StringRef - Represent a constant reference to a string, i.e.
WritableBinaryStreamRef()=default
LLVM_ABI Error writeBytes(uint64_t Offset, ArrayRef< uint8_t > Data) const
Given an Offset into this WritableBinaryStreamRef and some input data, writes the data to the underly...
LLVM_ABI Error commit()
For buffered streams, commits changes to the backing store.
A BinaryStream which can be read from as well as written to.
This is an optimization pass for GlobalISel generic memory operations.
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
FunctionAddr VTableAddr uintptr_t uintptr_t Data
Implement std::hash so that hash_code can be used in STL containers.