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();
61 const SegmentInjection *FLI =
64 : &InjectMethodOverloadList;
65 const uint8_t *FLIB =
reinterpret_cast<const uint8_t *
>(FLI);
66 InjectedSegmentBytes =
76 Prefix.RecordKind = Type.
Type;
80 template <
typename RecordType>
94 cantFail(Mapping.visitKnownMember(CVMR, Record));
99 assert(getCurrentSegmentLength() % 4 == 0);
112 insertSegmentEnd(OriginalOffset);
120 assert(getCurrentSegmentLength() % 4 == 0);
124 uint32_t ContinuationRecordBuilder::getCurrentSegmentLength()
const {
128 void ContinuationRecordBuilder::insertSegmentEnd(
uint32_t Offset) {
131 assert(Offset > SegmentBegin);
137 Buffer.
insert(Offset, InjectedSegmentBytes);
140 uint32_t SegmentLength = NewSegmentBegin - SegmentOffsets.
back();
141 (void) SegmentLength;
143 assert(SegmentLength % 4 == 0);
145 SegmentOffsets.
push_back(NewSegmentBegin);
152 CVType ContinuationRecordBuilder::createSegmentRecord(
154 assert(OffEnd - OffBegin <= USHRT_MAX);
157 Data = Data.
slice(OffBegin, OffEnd - OffBegin);
171 ContinuationRecord *CR =
172 reinterpret_cast<ContinuationRecord *
>(Continuation.data());
173 assert(CR->Kind == TypeLeafKind::LF_INDEX);
174 assert(CR->IndexRef == 0xB0C0B0C0);
175 CR->IndexRef = RefersTo->
getIndex();
232 std::vector<CVType> Types;
233 Types.reserve(SegmentOffsets.
size());
241 Types.push_back(createSegmentRecord(Offset, End, RefersTo));
253 #define TYPE_RECORD(EnumName, EnumVal, Name) 254 #define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) 255 #define MEMBER_RECORD(EnumName, EnumVal, Name) \ 256 template void llvm::codeview::ContinuationRecordBuilder::writeMemberType( \ 257 Name##Record &Record); 258 #define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) 259 #include "llvm/DebugInfo/CodeView/CodeViewTypes.def" 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.
MutableArrayRef< T > slice(size_t N, size_t M) const
slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array...
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
static SegmentInjection InjectFieldList(TypeLeafKind::LF_FIELDLIST)
This class represents lattice values for constants.
uint32_t getLength() const
TypeLeafKind
Duplicate copy of the above enum, but using the official CV names.
void push_back(const T &Elt)
void writeMemberType(RecordType &Record)
void insert(uint32_t Offset, ArrayRef< uint8_t > Bytes)
detail::packed_endian_specific_integral< uint16_t, little, unaligned > ulittle16_t
Error visitMemberEnd(CVMemberRecord &Record) override
static SegmentInjection InjectMethodOverloadList(TypeLeafKind::LF_METHODLIST)
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
Error visitTypeEnd(CVType &Record) override
auto reverse(ContainerTy &&C, typename std::enable_if< has_rbegin< ContainerTy >::value >::type *=nullptr) -> decltype(make_range(C.rbegin(), C.rend()))
Error visitTypeBegin(CVType &Record) override
Paired begin/end actions for all types.
static constexpr uint32_t MaxSegmentLength
The instances of the Type class are immutable: once they are created, they are never changed...
detail::packed_endian_specific_integral< uint32_t, little, unaligned > ulittle32_t
uint32_t getOffset() const
size_t size() const
size - Get the array size.
Provides write only access to a subclass of WritableBinaryStream.
Error writeInteger(T Value)
Write the integer Value to the underlying stream in the specified endianness.
static constexpr uint32_t ContinuationLength
uint32_t getIndex() const
uint32_t bytesRemaining() const
static void addPadding(BinaryStreamWriter &Writer)
MutableArrayRef< uint8_t > data()
MutableArrayRef< T > take_back(size_t N=1) const
Return a copy of *this with only the last N elements.
Error writeEnum(T Num)
Similar to writeInteger.
void setOffset(uint32_t Off)
static TypeLeafKind getTypeLeafKind(ContinuationRecordKind CK)
std::vector< CVType > end(TypeIndex Index)
ArrayRef< uint8_t > RecordData
~ContinuationRecordBuilder()
ContinuationRecordBuilder()
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void begin(ContinuationRecordKind RecordKind)
Error visitMemberBegin(CVMemberRecord &Record) override