7struct ContinuationRecord {
13struct SegmentInjection {
16 ContinuationRecord Cont;
26 int PaddingBytes = 4 -
Align;
27 while (PaddingBytes > 0) {
47 : SegmentWriter(Buffer), Mapping(SegmentWriter) {}
55 SegmentWriter.setOffset(0);
56 SegmentOffsets.clear();
57 SegmentOffsets.push_back(0);
58 assert(SegmentWriter.getOffset() == 0);
59 assert(SegmentWriter.getLength() == 0);
61 const SegmentInjection *FLI =
66 InjectedSegmentBytes =
74 cantFail(SegmentWriter.writeObject(Prefix));
77template <
typename RecordType>
81 uint32_t OriginalOffset = SegmentWriter.getOffset();
90 cantFail(Mapping.visitMemberBegin(CVMR));
92 cantFail(Mapping.visitMemberEnd(CVMR));
96 assert(getCurrentSegmentLength() % 4 == 0);
107 uint32_t MemberLength = SegmentWriter.getOffset() - OriginalOffset;
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());
229 uint32_t End = SegmentWriter.getOffset();
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 LLVM_ABI void \
249 llvm::codeview::ContinuationRecordBuilder::writeMemberType( \
250 Name##Record &Record);
251#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
252#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
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)
FunctionLoweringInfo::StatepointRelocationRecord RecordType
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)
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.
LLVM_ABI void begin(ContinuationRecordKind RecordKind)
LLVM_ABI std::vector< CVType > end(TypeIndex Index)
LLVM_ABI ~ContinuationRecordBuilder()
LLVM_ABI ContinuationRecordBuilder()
void writeMemberType(RecordType &Record)
CVRecord< TypeLeafKind > CVType
TypeLeafKind
Duplicate copy of the above enum, but using the official CV names.
detail::packed_endian_specific_integral< uint32_t, llvm::endianness::little, unaligned > ulittle32_t
detail::packed_endian_specific_integral< uint16_t, llvm::endianness::little, unaligned > ulittle16_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.
FunctionAddr VTableAddr uintptr_t uintptr_t Data
This struct is a compact representation of a valid (non-zero power of two) alignment.