9#ifndef LLVM_SUPPORT_BINARYSTREAMREF_H
10#define LLVM_SUPPORT_BINARYSTREAMREF_H
34 std::optional<uint64_t>
Length)
38 std::optional<uint64_t>
Length)
64 RefType Result(
static_cast<const RefType &
>(*
this));
68 Result.ViewOffset +=
N;
81 RefType Result(
static_cast<const RefType &
>(*
this));
123 if (
LHS.BorrowedImpl !=
RHS.BorrowedImpl)
125 if (
LHS.ViewOffset !=
RHS.ViewOffset)
127 if (
LHS.Length !=
RHS.Length)
159 std::optional<uint64_t>
Length)
166 std::optional<uint64_t>
Length);
204 return {Off +
Offset, SubSub};
211 std::pair<BinarySubstreamRef, BinarySubstreamRef>
split(
uint64_t Off)
const {
219class WritableBinaryStreamRef
221 WritableBinaryStream> {
241 std::optional<uint64_t>
Length);
245 WritableBinaryStreamRef &
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
friend bool operator==(const RefType &LHS, const RefType &RHS)
std::optional< uint64_t > Length
RefType drop_back(uint64_t N) const
Return a new BinaryStreamRef with the last N elements removed.
BinaryStreamRefBase & operator=(const BinaryStreamRefBase &Other)=default
RefType drop_front(uint64_t N) const
Return a new BinaryStreamRef with the first N elements removed.
BinaryStreamRefBase()=default
BinaryStreamRefBase & operator=(BinaryStreamRefBase &&Other)=default
BinaryStreamRefBase(StreamType &BorrowedImpl, uint64_t Offset, std::optional< uint64_t > Length)
std::shared_ptr< StreamType > SharedImpl
StreamType * BorrowedImpl
Error checkOffsetForRead(uint64_t Offset, uint64_t DataSize) const
RefType drop_symmetric(uint64_t N) const
Return a new BinaryStreamRef with the first and last N elements removed.
BinaryStreamRefBase(std::shared_ptr< StreamType > SharedImpl, uint64_t Offset, std::optional< uint64_t > Length)
RefType slice(uint64_t Offset, uint64_t Len) const
Return a new BinaryStreamRef with the first Offset elements removed, and retaining exactly Len elemen...
BinaryStreamRefBase(StreamType &BorrowedImpl)
llvm::endianness getEndian() const
RefType keep_back(uint64_t N) const
Return a new BinaryStreamRef with only the last N elements remaining.
RefType keep_front(uint64_t N) const
Return a new BinaryStreamRef with only the first N elements remaining.
BinaryStreamRefBase(BinaryStreamRefBase &&Other)=default
uint64_t getLength() const
BinaryStreamRefBase(const BinaryStreamRefBase &Other)=default
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
BinaryStreamRef(BinaryStreamRef &&Other)=default
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 ...
BinaryStreamRef(const BinaryStreamRef &Other)=default
BinaryStreamRef(BinaryStreamRef &S, uint64_t Offset, uint64_t Length)=delete
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.
friend class WritableBinaryStreamRef
BinaryStreamRef()=default
BinaryStreamRef & operator=(BinaryStreamRef &&Other)=default
BinaryStreamRef & operator=(const BinaryStreamRef &Other)=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 & operator=(const WritableBinaryStreamRef &Other)=default
WritableBinaryStreamRef(const WritableBinaryStreamRef &Other)=default
WritableBinaryStreamRef()=default
WritableBinaryStreamRef(WritableBinaryStreamRef &&Other)=default
WritableBinaryStreamRef(WritableBinaryStreamRef &S, uint64_t Offset, uint64_t Length)=delete
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...
WritableBinaryStreamRef & operator=(WritableBinaryStreamRef &&Other)=default
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.
FunctionAddr VTableAddr uintptr_t uintptr_t DataSize
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
FunctionAddr VTableAddr uintptr_t uintptr_t Data
std::pair< BinarySubstreamRef, BinarySubstreamRef > split(uint64_t Off) const
BinarySubstreamRef keep_front(uint64_t N) const
BinarySubstreamRef slice(uint64_t Off, uint64_t Size) const
BinaryStreamRef StreamData
BinarySubstreamRef drop_front(uint64_t N) const