10 #ifndef LLVM_SUPPORT_BINARYSTREAMREF_H 11 #define LLVM_SUPPORT_BINARYSTREAMREF_H 31 Length = BorrowedImpl.getLength();
36 : SharedImpl(SharedImpl),
BorrowedImpl(SharedImpl.get()),
40 : BorrowedImpl(&BorrowedImpl),
ViewOffset(Offset), Length(Length) {}
67 RefType Result(static_cast<const RefType &>(*
this));
71 Result.ViewOffset +=
N;
72 if (Result.Length.hasValue())
84 RefType Result(static_cast<const RefType &>(*
this));
92 if (!Result.Length.hasValue())
130 if (
Length != Other.Length)
207 return {Off +
Offset, SubSub};
214 std::pair<BinarySubstreamRef, BinarySubstreamRef>
225 WritableBinaryStream> {
275 #endif // LLVM_SUPPORT_BINARYSTREAMREF_H BinarySubstreamRef slice(uint32_t Off, uint32_t Size) const
bool operator==(const RefType &Other) const
RefType slice(uint32_t Offset, uint32_t Len) const
Return a new BinaryStreamRef with the first Offset elements removed, and retaining exactly Len elemen...
This class represents lattice values for constants.
BinaryStreamRefBase & operator=(const BinaryStreamRefBase &Other)=default
StreamType * BorrowedImpl
BinaryStreamRefBase(std::shared_ptr< StreamType > SharedImpl, uint32_t Offset, Optional< uint32_t > Length)
std::shared_ptr< StreamType > SharedImpl
llvm::support::endianness getEndian() const
Common stuff for mutable and immutable StreamRefs.
RefType keep_back(uint32_t N) const
Return a new BinaryStreamRef with only the last N elements remaining.
BinaryStreamRefBase(StreamType &BorrowedImpl, uint32_t Offset, Optional< uint32_t > Length)
Optional< uint32_t > Length
An interface for accessing data in a stream-like format, but which discourages copying.
RefType drop_back(uint32_t N) const
Return a new BinaryStreamRef with the last N elements removed.
BinarySubstreamRef drop_front(uint32_t N) const
RefType drop_front(uint32_t N) const
Return a new BinaryStreamRef with the first N elements removed.
BinaryStreamRef StreamData
uint32_t getLength() const
static ErrorSuccess success()
Create a success value.
auto size(R &&Range, typename std::enable_if< std::is_same< typename std::iterator_traits< decltype(Range.begin())>::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr) -> decltype(std::distance(Range.begin(), Range.end()))
Get the size of a range.
std::pair< BinarySubstreamRef, BinarySubstreamRef > split(uint32_t Offset) const
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
RefType drop_symmetric(uint32_t N) const
Return a new BinaryStreamRef with the first and last N elements removed.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
BinarySubstreamRef keep_front(uint32_t N) const
RefType keep_front(uint32_t N) const
Return a new BinaryStreamRef with only the first N elements remaining.
BinaryStreamRefBase()=default
Lightweight error class with error context and mandatory checking.
BinaryStreamRefBase(StreamType &BorrowedImpl)
StringRef - Represent a constant reference to a string, i.e.
Error checkOffsetForRead(uint32_t Offset, uint32_t DataSize) const
A BinaryStream which can be read from as well as written to.