Go to the documentation of this file.
7 struct ContinuationRecord {
13 struct SegmentInjection {
16 ContinuationRecord Cont;
26 int PaddingBytes = 4 -
Align;
27 while (PaddingBytes > 0) {
28 uint8_t Pad =
static_cast<uint8_t
>(LF_PAD0 + PaddingBytes);
47 : SegmentWriter(Buffer), Mapping(SegmentWriter) {}
56 SegmentOffsets.
clear();
57 SegmentOffsets.push_back(0);
61 const SegmentInjection *FLI =
65 const uint8_t *FLIB =
reinterpret_cast<const uint8_t *
>(FLI);
66 InjectedSegmentBytes =
77 template <
typename RecordType>
96 assert(getCurrentSegmentLength() % 4 == 0);
109 insertSegmentEnd(OriginalOffset);
117 assert(getCurrentSegmentLength() % 4 == 0);
121 uint32_t ContinuationRecordBuilder::getCurrentSegmentLength()
const {
122 return SegmentWriter.
getOffset() - SegmentOffsets.back();
125 void ContinuationRecordBuilder::insertSegmentEnd(
uint32_t Offset) {
126 uint32_t SegmentBegin = SegmentOffsets.back();
128 assert(Offset > SegmentBegin);
134 Buffer.
insert(Offset, InjectedSegmentBytes);
137 uint32_t SegmentLength = NewSegmentBegin - SegmentOffsets.back();
138 (void) SegmentLength;
140 assert(SegmentLength % 4 == 0);
142 SegmentOffsets.push_back(NewSegmentBegin);
149 CVType ContinuationRecordBuilder::createSegmentRecord(
151 assert(OffEnd - OffBegin <= USHRT_MAX);
154 Data =
Data.slice(OffBegin, OffEnd - OffBegin);
163 ContinuationRecord *CR =
164 reinterpret_cast<ContinuationRecord *
>(Continuation.data());
165 assert(CR->Kind == TypeLeafKind::LF_INDEX);
166 assert(CR->IndexRef == 0xB0C0B0C0);
167 CR->IndexRef = RefersTo->
getIndex();
224 std::vector<CVType> Types;
225 Types.reserve(SegmentOffsets.size());
233 Types.push_back(createSegmentRecord(Offset, End, RefersTo));
245 #define TYPE_RECORD(EnumName, EnumVal, Name)
246 #define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
247 #define MEMBER_RECORD(EnumName, EnumVal, Name) \
248 template void llvm::codeview::ContinuationRecordBuilder::writeMemberType( \
249 Name##Record &Record);
250 #define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
251 #include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
std::vector< CVType > end(TypeIndex Index)
This is an optimization pass for GlobalISel generic memory operations.
Error writeInteger(T Value)
Write the integer Value to the underlying stream in the specified endianness.
Error writeEnum(T Num)
Similar to writeInteger.
static constexpr uint32_t ContinuationLength
Provides write only access to a subclass of WritableBinaryStream.
Helper object to track which of three possible relocation mechanisms are used for a particular value ...
static SegmentInjection InjectMethodOverloadList(TypeLeafKind::LF_METHODLIST)
The instances of the Type class are immutable: once they are created, they are never changed.
auto reverse(ContainerTy &&C, std::enable_if_t< has_rbegin< ContainerTy >::value > *=nullptr)
Error visitTypeEnd(CVType &Record) override
void setOffset(uint64_t Off)
void writeMemberType(RecordType &Record)
Error visitMemberEnd(CVMemberRecord &Record) override
~ContinuationRecordBuilder()
MutableArrayRef< uint8_t > data()
This struct is a compact representation of a valid (non-zero power of two) alignment.
static constexpr uint32_t MaxSegmentLength
Error visitTypeBegin(CVType &Record) override
Paired begin/end actions for all types.
Error visitMemberBegin(CVMemberRecord &Record) override
detail::packed_endian_specific_integral< uint32_t, little, unaligned > ulittle32_t
detail::packed_endian_specific_integral< uint16_t, little, unaligned > ulittle16_t
uint64_t bytesRemaining() const
static void addPadding(BinaryStreamWriter &Writer)
void begin(ContinuationRecordKind RecordKind)
static TypeLeafKind getTypeLeafKind(ContinuationRecordKind CK)
void insert(uint64_t Offset, ArrayRef< uint8_t > Bytes)
uint64_t getOffset() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Error writeObject(const T &Obj)
Writes the object Obj to the underlying stream, as if by using memcpy.
void cantFail(Error Err, const char *Msg=nullptr)
Report a fatal error if Err is a failure value.
uint32_t getIndex() const
TypeLeafKind
Duplicate copy of the above enum, but using the official CV names.
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
uint64_t getLength() const
ContinuationRecordBuilder()
CVRecord< TypeLeafKind > CVType
static SegmentInjection InjectFieldList(TypeLeafKind::LF_FIELDLIST)