9 #ifndef LLVM_SUPPORT_DATAEXTRACTOR_H 10 #define LLVM_SUPPORT_DATAEXTRACTOR_H 22 Bytes[0] = Bytes[1] = Bytes[2] = U;
24 Uint24(uint8_t U0, uint8_t U1, uint8_t U2) {
25 Bytes[0] = U0; Bytes[1] = U1; Bytes[2] = U2;
28 int LoIx = IsLittleEndian ? 0 : 2;
29 return Bytes[LoIx] + (Bytes[1] << 8) + (Bytes[2-LoIx] << 16);
34 static_assert(
sizeof(
uint24_t) == 3,
"sizeof(uint24_t) != 3");
43 uint8_t IsLittleEndian;
67 explicit operator bool() {
return !Err; }
84 : Data(Data), IsLittleEndian(IsLittleEndian), AddressSize(AddressSize) {}
89 IsLittleEndian(IsLittleEndian), AddressSize(AddressSize) {}
120 const char *getCStr(uint64_t *offset_ptr)
const;
142 StringRef getCStrRef(uint64_t *offset_ptr)
const;
175 Error *Err =
nullptr)
const;
207 int64_t getSigned(uint64_t *offset_ptr,
uint32_t size)
const;
255 uint8_t getU8(uint64_t *offset_ptr,
Error *Err =
nullptr)
const;
285 uint8_t *getU8(uint64_t *offset_ptr, uint8_t *dst,
uint32_t count)
const;
299 if (isValidOffsetForDataOfSize(C.Offset, Count))
304 getU8(C, Dst.
data(), Count);
329 uint16_t getU16(uint64_t *offset_ptr,
Error *Err =
nullptr)
const;
376 uint32_t getU24(uint64_t *offset_ptr)
const;
398 uint32_t getU32(uint64_t *offset_ptr,
Error *Err =
nullptr)
const;
450 uint64_t getU64(uint64_t *offset_ptr,
Error *Err =
nullptr)
const;
480 uint64_t *getU64(uint64_t *offset_ptr, uint64_t *dst,
uint32_t count)
const;
498 int64_t getSLEB128(uint64_t *offset_ptr)
const;
522 uint64_t getULEB128(uint64_t *offset_ptr,
llvm::Error *Err =
nullptr)
const;
552 return offset + length >= offset && isValidOffset(offset + length - 1);
563 return isValidOffsetForDataOfSize(offset, AddressSize);
This class represents lattice values for constants.
static bool skip(DataExtractor &Data, uint64_t &Offset, bool SkippedRanges)
Skip an InlineInfo object in the specified data at the specified offset.
uint32_t getAsUint32(bool IsLittleEndian) const
static bool getUnsigned(const MIToken &Token, unsigned &Result, ErrorCallbackType ErrCB)
An auxiliary type to facilitate extraction of 3-byte entities.
LLVM_NODISCARD size_t size() const
size - Get the string size.
auto count(R &&Range, const E &Element) -> typename std::iterator_traits< decltype(adl_begin(Range))>::difference_type
Wrapper function around std::count to count the number of times an element Element occurs in the give...
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.
uint24_t getSwappedBytes(uint24_t C)
Needed by swapByteOrder().
pointer data()
Return a pointer to the vector's buffer, even if empty().
Uint24(uint8_t U0, uint8_t U1, uint8_t U2)
Lightweight error class with error context and mandatory checking.
StringRef - Represent a constant reference to a string, i.e.