10 #ifndef LLVM_DEBUGINFO_CODEVIEW_CODEVIEWRECORDIO_H
11 #define LLVM_DEBUGINFO_CODEVIEW_CODEVIEWRECORDIO_H
25 #include <type_traits>
44 bool isReading()
const {
return Reader !=
nullptr; }
71 using U =
typename std::underlying_type<T>::type;
74 X = static_cast<U>(Value);
79 Value = static_cast<T>(X);
91 template <
typename SizeType,
typename T,
typename ElementMapper>
95 Size =
static_cast<SizeType
>(Items.size());
99 for (
auto &
X : Items) {
100 if (
auto EC = Mapper(*
this,
X))
106 for (SizeType
I = 0;
I < Size; ++
I) {
107 typename T::value_type Item;
108 if (
auto EC = Mapper(*
this, Item))
110 Items.push_back(Item);
117 template <
typename T,
typename ElementMapper>
120 for (
auto &Item : Items) {
121 if (
auto EC = Mapper(*
this, Item))
125 typename T::value_type
Field;
127 while (!Reader->
empty() && Reader->
peek() < 0xf0 ) {
128 if (
auto EC = Mapper(*
this, Field))
130 Items.push_back(Field);
142 Error writeEncodedSignedInteger(
const int64_t &
Value);
143 Error writeEncodedUnsignedInteger(
const uint64_t &
Value);
150 if (!MaxLength.hasValue())
152 assert(CurrentOffset >= BeginOffset);
154 uint32_t BytesUsed = CurrentOffset - BeginOffset;
155 if (BytesUsed >= *MaxLength)
157 return *MaxLength - BytesUsed;
161 SmallVector<RecordLimit, 2> Limits;
163 msf::StreamReader *Reader =
nullptr;
164 msf::StreamWriter *Writer =
nullptr;
170 #endif // LLVM_DEBUGINFO_CODEVIEW_CODEVIEWRECORDIO_H
Error mapByteVectorTail(ArrayRef< uint8_t > &Bytes)
Error mapVectorN(T &Items, const ElementMapper &Mapper)
Error mapObject(T &Value)
Error mapInteger(TypeIndex &TypeInd)
Error mapStringZVectorZ(std::vector< StringRef > &Value)
Error beginRecord(Optional< uint32_t > MaxLength)
Error writeObject(const T &Obj)
CodeViewRecordIO(msf::StreamReader &Reader)
CodeViewRecordIO(msf::StreamWriter &Writer)
Error mapGuid(StringRef &Guid)
Error readInteger(uint8_t &Dest)
Error mapInteger(T &Value)
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang","erlang-compatible garbage collector")
uint32_t maxFieldLength() const
Error writeInteger(uint8_t Int)
uint32_t getOffset() const
static ErrorSuccess success()
Create a success value.
Error mapEncodedInteger(int64_t &Value)
uint32_t getOffset() const
Error mapStringZ(StringRef &Value)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
Lightweight error class with error context and mandatory checking.
Error mapVectorTail(T &Items, const ElementMapper &Mapper)
StringRef - Represent a constant reference to a string, i.e.
Error readObject(const T *&Dest)