9#ifndef LLVM_DEBUGINFO_CODEVIEW_TYPEDESERIALIZER_H
10#define LLVM_DEBUGINFO_CODEVIEW_TYPEDESERIALIZER_H
45 if (
auto EC =
I.Mapping.visitTypeBegin(CVT))
47 if (
auto EC =
I.Mapping.visitKnownRecord(CVT,
Record))
49 if (
auto EC =
I.Mapping.visitTypeEnd(CVT))
62 if (
auto EC = deserializeAs<T>(CVT,
Record))
68 assert(!Mapping &&
"Already in a type mapping!");
69 Mapping = std::make_unique<MappingInfo>(
Record.content());
70 return Mapping->Mapping.visitTypeBegin(
Record);
78 assert(Mapping &&
"Not in a type mapping!");
79 auto EC = Mapping->Mapping.visitTypeEnd(
Record);
84#define TYPE_RECORD(EnumName, EnumVal, Name) \
85 Error visitKnownRecord(CVType &CVR, Name##Record &Record) override { \
86 return visitKnownRecordImpl<Name##Record>(CVR, Record); \
88#define MEMBER_RECORD(EnumName, EnumVal, Name)
89#define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
90#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
91#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
94 template <
typename RecordType>
96 return Mapping->Mapping.visitKnownRecord(CVR,
Record);
99 std::unique_ptr<MappingInfo> Mapping;
105 : Reader(R), Mapping(Reader), StartOffset(0) {}
126 Mapping.StartOffset = Mapping.Reader.getOffset();
127 return Mapping.Mapping.visitMemberBegin(
Record);
131 if (
auto EC = Mapping.Mapping.visitMemberEnd(
Record))
136#define TYPE_RECORD(EnumName, EnumVal, Name)
137#define MEMBER_RECORD(EnumName, EnumVal, Name) \
138 Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override { \
139 return visitKnownMemberImpl<Name##Record>(CVR, Record); \
141#define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
142#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
143#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
146 template <
typename RecordType>
147 Error visitKnownMemberImpl(CVMemberRecord &CVR,
RecordType &Record) {
148 if (
auto EC = Mapping.Mapping.visitKnownMember(CVR, Record))
151 uint32_t EndOffset = Mapping.Reader.getOffset();
152 uint32_t RecordLength = EndOffset - Mapping.StartOffset;
153 Mapping.Reader.setOffset(Mapping.StartOffset);
154 if (
auto EC = Mapping.Reader.readBytes(CVR.Data, RecordLength))
156 assert(Mapping.Reader.getOffset() == EndOffset);
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
An implementation of BinaryStream which holds its entire data set in a single contiguous buffer.
Provides read only access to a subclass of BinaryStream.
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.
ArrayRef< uint8_t > content() const
Error visitMemberEnd(CVMemberRecord &Record) override
FieldListDeserializer(BinaryStreamReader &Reader)
~FieldListDeserializer() override
Error visitMemberBegin(CVMemberRecord &Record) override
Error visitTypeEnd(CVType &Record) override
TypeDeserializer()=default
Error visitTypeBegin(CVType &Record, TypeIndex Index) override
Error visitTypeBegin(CVType &Record) override
Paired begin/end actions for all types.
static Expected< T > deserializeAs(ArrayRef< uint8_t > Data)
static Error deserializeAs(CVType &CVT, T &Record)
TypeRecordKind
Distinguishes individual records in .debug$T or .debug$P section or PDB type stream.
This is an optimization pass for GlobalISel generic memory operations.
void consumeError(Error Err)
Consume a Error without doing anything.
Helper object to track which of three possible relocation mechanisms are used for a particular value ...