9#ifndef LLVM_DEBUGINFO_CODEVIEW_CODEVIEWRECORDIO_H
10#define LLVM_DEBUGINFO_CODEVIEW_CODEVIEWRECORDIO_H
62 : Streamer(&Streamer) {}
70 return (Streamer !=
nullptr) && (Reader ==
nullptr) && (Writer ==
nullptr);
73 return (Reader !=
nullptr) && (Streamer ==
nullptr) && (Writer ==
nullptr);
76 return (Writer !=
nullptr) && (Streamer ==
nullptr) && (Reader ==
nullptr);
86 incrStreamedLen(
sizeof(
T));
102 emitComment(Comment);
104 incrStreamedLen(
sizeof(
T));
118 using U = std::underlying_type_t<T>;
122 X =
static_cast<U
>(
Value);
140 const Twine &Comment =
"");
142 template <
typename SizeType,
typename T,
typename ElementMapper>
144 const Twine &Comment =
"") {
147 Size =
static_cast<SizeType
>(Items.size());
148 emitComment(Comment);
150 incrStreamedLen(
sizeof(
Size));
152 for (
auto &
X : Items) {
153 if (
auto EC = Mapper(*
this,
X))
157 Size =
static_cast<SizeType
>(Items.size());
161 for (
auto &
X : Items) {
162 if (
auto EC = Mapper(*
this,
X))
168 for (SizeType
I = 0;
I <
Size; ++
I) {
169 typename T::value_type Item;
170 if (
auto EC = Mapper(*
this, Item))
172 Items.push_back(Item);
179 template <
typename T,
typename ElementMapper>
181 const Twine &Comment =
"") {
182 emitComment(Comment);
184 for (
auto &Item : Items) {
185 if (
auto EC = Mapper(*
this, Item))
189 typename T::value_type
Field;
191 while (!Reader->
empty() && Reader->
peek() < 0xf0 ) {
192 if (
auto EC = Mapper(*
this,
Field))
194 Items.push_back(
Field);
202 const Twine &Comment =
"");
219 void emitEncodedSignedInteger(
const int64_t &
Value,
220 const Twine &Comment =
"");
222 const Twine &Comment =
"");
223 Error writeEncodedSignedInteger(
const int64_t &
Value);
226 void incrStreamedLen(
const uint64_t &Len) {
231 void resetStreamedLen() {
236 void emitComment(
const Twine &Comment) {
238 Twine TComment(Comment);
239 if (!TComment.isTriviallyEmpty())
246 std::optional<uint32_t> MaxLength;
248 std::optional<uint32_t> bytesRemaining(
uint32_t CurrentOffset)
const {
251 assert(CurrentOffset >= BeginOffset);
253 uint32_t BytesUsed = CurrentOffset - BeginOffset;
254 if (BytesUsed >= *MaxLength)
256 return *MaxLength - BytesUsed;
260 SmallVector<RecordLimit, 2> Limits;
262 BinaryStreamReader *Reader =
nullptr;
263 BinaryStreamWriter *Writer =
nullptr;
264 CodeViewRecordStreamer *Streamer =
nullptr;
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
OptimizedStructLayoutField Field
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallVector class.
An arbitrary precision integer that knows its signedness.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Provides read only access to a subclass of BinaryStream.
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...
uint8_t peek() const
Examine the next byte of the underlying stream without advancing the stream's offset.
Error readInteger(T &Dest)
Read an integer of the specified endianness into Dest and update the stream's offset.
uint64_t getOffset() const
Provides write only access to a subclass of WritableBinaryStream.
uint64_t getOffset() const
Error writeInteger(T Value)
Write the integer Value to the underlying stream in the specified endianness.
Error writeObject(const T &Obj)
Writes the object Obj to the underlying stream, as if by using memcpy.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
StringRef - Represent a constant reference to a string, i.e.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LLVM Value Representation.
Error mapVectorTail(T &Items, const ElementMapper &Mapper, const Twine &Comment="")
CodeViewRecordIO(BinaryStreamWriter &Writer)
Error padToAlignment(uint32_t Align)
Error mapVectorN(T &Items, const ElementMapper &Mapper, const Twine &Comment="")
Error mapInteger(T &Value, const Twine &Comment="")
Error mapInteger(TypeIndex &TypeInd, const Twine &Comment="")
CodeViewRecordIO(BinaryStreamReader &Reader)
Error mapGuid(GUID &Guid, const Twine &Comment="")
Error mapStringZVectorZ(std::vector< StringRef > &Value, const Twine &Comment="")
Error mapStringZ(StringRef &Value, const Twine &Comment="")
Error mapObject(T &Value)
uint64_t getStreamedLen()
Error mapEnum(T &Value, const Twine &Comment="")
Error mapEncodedInteger(int64_t &Value, const Twine &Comment="")
Error beginRecord(std::optional< uint32_t > MaxLength)
Error mapByteVectorTail(ArrayRef< uint8_t > &Bytes, const Twine &Comment="")
CodeViewRecordIO(CodeViewRecordStreamer &Streamer)
uint32_t maxFieldLength() const
void emitRawComment(const Twine &T)
virtual void emitBytes(StringRef Data)=0
virtual bool isVerboseAsm()=0
virtual void AddComment(const Twine &T)=0
virtual void emitIntValue(uint64_t Value, unsigned Size)=0
virtual void emitBinaryData(StringRef Data)=0
virtual std::string getTypeName(TypeIndex TI)=0
virtual ~CodeViewRecordStreamer()=default
virtual void AddRawComment(const Twine &T)=0
This is an optimization pass for GlobalISel generic memory operations.
ArrayRef(const T &OneElt) -> ArrayRef< T >
This struct is a compact representation of a valid (non-zero power of two) alignment.
This represents the 'GUID' type from windows.h.