LLVM: include/llvm/DebugInfo/CodeView/CVRecord.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9#ifndef LLVM_DEBUGINFO_CODEVIEW_CVRECORD_H
10#define LLVM_DEBUGINFO_CODEVIEW_CVRECORD_H
11
20#include
21
22namespace llvm {
23
25
26
27
28
30public:
32
34
37
38 bool valid() const { return kind() != Kind(0); }
39
41
44 return Kind(0);
45 return static_cast<Kind>(static_cast<uint16_t>(
47 }
48
50
55
59
61};
62
63
66
67template <typename Record, typename Func>
69 while (!StreamBuffer.empty()) {
72
75
76 size_t RealLen = Prefix->RecordLen + 2;
77 if (StreamBuffer.size() < RealLen)
79
81 StreamBuffer = StreamBuffer.drop_front(RealLen);
82
85 return EC;
86 }
88}
89
90
91template
97
99 return std::move(EC);
100 if (Prefix->RecordLen < 2)
102
105 if (auto EC = Reader.readBytes(RawData, Prefix->RecordLen + sizeof(uint16_t)))
106 return std::move(EC);
108}
109
110}
111
112template
117 if (!ExpectedRec)
118 return ExpectedRec.takeError();
119 Item = *ExpectedRec;
120 Len = ExpectedRec->length();
122 }
123};
124
125namespace codeview {
129}
130
131}
132
133#endif
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
ArrayRef< T > take_front(size_t N=1) const
Return a copy of *this with only the first N elements.
ArrayRef< T > drop_front(size_t N=1) const
Drop the first N elements of the array.
size_t size() const
size - Get the array size.
bool empty() const
empty - Check if the array is empty.
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...
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 ...
void setOffset(uint64_t Off)
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
StringRef - Represent a constant reference to a string, i.e.
CVRecord is a fat pointer (base + size pair) to a symbol or type record.
Definition CVRecord.h:29
CVRecord(ArrayRef< uint8_t > Data)
Definition CVRecord.h:33
bool valid() const
Definition CVRecord.h:38
StringRef str_data() const
Definition CVRecord.h:51
CVRecord(const RecordPrefix *P, size_t Size)
Definition CVRecord.h:35
ArrayRef< uint8_t > data() const
Definition CVRecord.h:49
Kind kind() const
Definition CVRecord.h:42
ArrayRef< uint8_t > RecordData
Definition CVRecord.h:60
ArrayRef< uint8_t > content() const
Definition CVRecord.h:56
uint32_t length() const
Definition CVRecord.h:40
A range adaptor for a pair of iterators.
iterator_range< CVTypeArray::Iterator > CVTypeRange
Definition CVRecord.h:128
CVRecord< TypeLeafKind > CVType
Definition CVRecord.h:64
VarStreamArray< CVSymbol > CVSymbolArray
Definition CVRecord.h:126
Error forEachCodeViewRecord(ArrayRef< uint8_t > StreamBuffer, Func F)
Definition CVRecord.h:68
VarStreamArray< CVType > CVTypeArray
Definition CVRecord.h:127
CVRecord< SymbolKind > CVSymbol
Definition CVRecord.h:65
Expected< CVRecord< Kind > > readCVRecordFromStream(BinaryStreamRef Stream, uint32_t Offset)
Read a complete record from a stream at a random offset.
Definition CVRecord.h:92
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.
FunctionAddr VTableAddr uintptr_t uintptr_t Data