7struct ContinuationRecord {
13struct SegmentInjection {
16 ContinuationRecord Cont;
26 int PaddingBytes = 4 -
Align;
27 while (PaddingBytes > 0) {
42 return (CK == ContinuationRecordKind::FieldList) ? LF_FIELDLIST
47 : SegmentWriter(Buffer), Mapping(SegmentWriter) {}
56 SegmentOffsets.
clear();
61 const SegmentInjection *FLI =
66 InjectedSegmentBytes =
77template <
typename RecordType>
96 assert(getCurrentSegmentLength() % 4 == 0);
109 insertSegmentEnd(OriginalOffset);
117 assert(getCurrentSegmentLength() % 4 == 0);
121uint32_t ContinuationRecordBuilder::getCurrentSegmentLength()
const {
125void ContinuationRecordBuilder::insertSegmentEnd(
uint32_t Offset) {
137 uint32_t SegmentLength = NewSegmentBegin - SegmentOffsets.
back();
138 (void) SegmentLength;
140 assert(SegmentLength % 4 == 0);
142 SegmentOffsets.
push_back(NewSegmentBegin);
149CVType 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());
231 std::optional<TypeIndex> RefersTo;
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"
static constexpr uint32_t ContinuationLength
static TypeLeafKind getTypeLeafKind(ContinuationRecordKind CK)
static constexpr uint32_t MaxSegmentLength
static SegmentInjection InjectFieldList(TypeLeafKind::LF_FIELDLIST)
static SegmentInjection InjectMethodOverloadList(TypeLeafKind::LF_METHODLIST)
static void addPadding(BinaryStreamWriter &Writer)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
MutableArrayRef< uint8_t > data()
void insert(uint64_t Offset, ArrayRef< uint8_t > Bytes)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
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.
uint64_t bytesRemaining() const
uint64_t getLength() const
void setOffset(uint64_t Off)
Error writeEnum(T Num)
Similar to writeInteger.
Error writeObject(const T &Obj)
Writes the object Obj to the underlying stream, as if by using memcpy.
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
void push_back(const T &Elt)
The instances of the Type class are immutable: once they are created, they are never changed.
void begin(ContinuationRecordKind RecordKind)
std::vector< CVType > end(TypeIndex Index)
~ContinuationRecordBuilder()
ContinuationRecordBuilder()
void writeMemberType(RecordType &Record)
Error visitTypeBegin(CVType &Record) override
Paired begin/end actions for all types.
Error visitMemberBegin(CVMemberRecord &Record) override
Error visitTypeEnd(CVType &Record) override
Error visitMemberEnd(CVMemberRecord &Record) override
CVRecord< TypeLeafKind > CVType
TypeLeafKind
Duplicate copy of the above enum, but using the official CV names.
detail::packed_endian_specific_integral< uint16_t, llvm::endianness::little, unaligned > ulittle16_t
detail::packed_endian_specific_integral< uint32_t, llvm::endianness::little, unaligned > ulittle32_t
This is an optimization pass for GlobalISel generic memory operations.
auto reverse(ContainerTy &&C)
void cantFail(Error Err, const char *Msg=nullptr)
Report a fatal error if Err is a failure value.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Helper object to track which of three possible relocation mechanisms are used for a particular value ...