9#ifndef LLVM_SUPPORT_BINARYSTREAMREADER_H 
   10#define LLVM_SUPPORT_BINARYSTREAMREADER_H 
   70    static_assert(std::is_integral_v<T>,
 
   71                  "Cannot call readInteger with non-integral value!");
 
 
   83    static_assert(std::is_enum<T>::value,
 
   84                  "Cannot call readEnum with non-enum value!");
 
   85    std::underlying_type_t<T> 
N;
 
   88    Dest = 
static_cast<T>(
N);
 
 
  166    Dest = 
reinterpret_cast<const T *
>(Buffer.
data());
 
 
  179  template <
typename T>
 
  182    if (NumElements == 0) {
 
  187    if (NumElements > UINT32_MAX / 
sizeof(
T))
 
  191    if (
auto EC = 
readBytes(Bytes, NumElements * 
sizeof(
T)))
 
  195           "Reading at invalid alignment!");
 
  197    Array = 
ArrayRef<T>(
reinterpret_cast<const T *
>(Bytes.
data()), NumElements);
 
 
  209  template <
typename T, 
typename U>
 
  215    Array.setUnderlyingStream(S, Skew);
 
 
  227  template <
typename T>
 
  234    if (NumItems > UINT32_MAX / 
sizeof(
T))
 
 
  266  LLVM_ABI std::pair<BinaryStreamReader, BinaryStreamReader>
 
 
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
 
Lightweight arrays that are backed by an arbitrary BinaryStream.
 
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
 
LLVM_ABI Error readStreamRef(BinaryStreamRef &Ref)
Read the entire remainder of the underlying stream into Ref.
 
BinaryStreamReader & operator=(const BinaryStreamReader &Other)=default
 
Error readObject(const T *&Dest)
Get a pointer to an object of type T from the underlying stream, as if by memcpy, and store the resul...
 
LLVM_ABI Error readCString(StringRef &Dest)
Read a null terminated string from Dest.
 
Error readArray(FixedStreamArray< T > &Array, uint32_t NumItems)
Read a FixedStreamArray of NumItems elements and store the result into Array.
 
LLVM_ABI Error readBytes(ArrayRef< uint8_t > &Buffer, uint32_t Size)
Read Size bytes from the underlying stream at the current offset and and set Buffer to the resulting ...
 
LLVM_ABI uint8_t peek() const
Examine the next byte of the underlying stream without advancing the stream's offset.
 
LLVM_ABI Error readWideString(ArrayRef< UTF16 > &Dest)
Similar to readCString, however read a null-terminated UTF16 string instead.
 
uint64_t getLength() const
 
LLVM_ABI Error readSubstream(BinarySubstreamRef &Ref, uint32_t Length)
Read Length bytes from the underlying stream into Ref.
 
Error readEnum(T &Dest)
Similar to readInteger.
 
Error readInteger(T &Dest)
Read an integer of the specified endianness into Dest and update the stream's offset.
 
BinaryStreamReader()=default
 
uint64_t bytesRemaining() const
 
uint64_t getOffset() const
 
LLVM_ABI Error readSLEB128(int64_t &Dest)
Read a signed LEB128 encoded value.
 
LLVM_ABI Error readLongestContiguousChunk(ArrayRef< uint8_t > &Buffer)
Read as much as possible from the underlying string at the current offset without invoking a copy,...
 
LLVM_ABI Error padToAlignment(uint32_t Align)
 
LLVM_ABI Error readFixedString(StringRef &Dest, uint32_t Length)
Read a Length byte string into Dest.
 
LLVM_ABI std::pair< BinaryStreamReader, BinaryStreamReader > split(uint64_t Offset) const
 
void setOffset(uint64_t Off)
 
Error readArray(ArrayRef< T > &Array, uint32_t NumElements)
Get a reference to a NumElements element array of objects of type T from the underlying stream as if ...
 
LLVM_ABI Error readULEB128(uint64_t &Dest)
Read an unsigned LEB128 encoded value.
 
LLVM_ABI Error skip(uint64_t Amount)
Advance the stream's offset by Amount bytes.
 
BinaryStreamReader(const BinaryStreamReader &Other)=default
 
Error readArray(VarStreamArray< T, U > &Array, uint32_t Size, uint32_t Skew=0)
Read a VarStreamArray of size Size bytes and store the result into Array.
 
virtual ~BinaryStreamReader()=default
 
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
 
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.
 
FixedStreamArray is similar to VarStreamArray, except with each record having a fixed-length.
 
StringRef - Represent a constant reference to a string, i.e.
 
value_type read(const void *memory, endianness endian)
Read a value of a particular endianness from memory.
 
This is an optimization pass for GlobalISel generic memory operations.
 
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
 
@ Ref
The access may reference the value stored in memory.
 
FunctionAddr VTableAddr uintptr_t uintptr_t Data
 
bool isAddrAligned(Align Lhs, const void *Addr)
Checks that Addr is a multiple of the alignment.
 
This struct is a compact representation of a valid (non-zero power of two) alignment.
 
static constexpr Align Of()
Allow constructions of constexpr Align from types.