10 #ifndef LLVM_DEBUGINFO_CODEVIEW_TYPEDESERIALIZER_H
11 #define LLVM_DEBUGINFO_CODEVIEW_TYPEDESERIALIZER_H
46 if (
auto EC =
I.Mapping.visitTypeBegin(CVT))
48 if (
auto EC =
I.Mapping.visitKnownRecord(CVT, Record))
50 if (
auto EC =
I.Mapping.visitTypeEnd(CVT))
56 assert(!Mapping &&
"Already in a type mapping!");
57 Mapping = llvm::make_unique<MappingInfo>(Record.
content());
58 return Mapping->Mapping.visitTypeBegin(Record);
66 assert(Mapping &&
"Not in a type mapping!");
67 auto EC = Mapping->Mapping.visitTypeEnd(Record);
72 #define TYPE_RECORD(EnumName, EnumVal, Name) \
73 Error visitKnownRecord(CVType &CVR, Name##Record &Record) override { \
74 return visitKnownRecordImpl<Name##Record>(CVR, Record); \
76 #define MEMBER_RECORD(EnumName, EnumVal, Name)
77 #define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
78 #define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
79 #include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
82 template <
typename RecordType>
84 return Mapping->Mapping.visitKnownRecord(CVR, Record);
87 std::unique_ptr<MappingInfo> Mapping;
93 : Reader(R), Mapping(Reader), StartOffset(0) {}
103 FieldList.
Type = TypeLeafKind::LF_FIELDLIST;
104 consumeError(Mapping.Mapping.visitTypeBegin(FieldList));
109 FieldList.
Type = TypeLeafKind::LF_FIELDLIST;
114 Mapping.StartOffset = Mapping.Reader.getOffset();
115 return Mapping.Mapping.visitMemberBegin(Record);
119 if (
auto EC = Mapping.Mapping.visitMemberEnd(Record))
124 #define TYPE_RECORD(EnumName, EnumVal, Name)
125 #define MEMBER_RECORD(EnumName, EnumVal, Name) \
126 Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override { \
127 return visitKnownMemberImpl<Name##Record>(CVR, Record); \
129 #define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
130 #define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
131 #include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
134 template <
typename RecordType>
135 Error visitKnownMemberImpl(CVMemberRecord &CVR, RecordType &Record) {
136 if (
auto EC = Mapping.Mapping.visitKnownMember(CVR, Record))
139 uint32_t EndOffset = Mapping.Reader.getOffset();
140 uint32_t RecordLength = EndOffset - Mapping.StartOffset;
141 Mapping.Reader.setOffset(Mapping.StartOffset);
142 if (
auto EC = Mapping.Reader.readBytes(CVR.Data, RecordLength))
144 assert(Mapping.Reader.getOffset() == EndOffset);
153 #endif // LLVM_DEBUGINFO_CODEVIEW_TYPEDESERIALIZER_H
An implementation of BinaryStream which holds its entire data set in a single contiguous buffer...
~FieldListDeserializer() override
Error visitTypeBegin(CVType &Record) override
Paired begin/end actions for all types.
TypeDeserializer()=default
TypeRecordKind
Distinguishes individual records in .debug$T section or PDB type stream.
Error visitMemberBegin(CVMemberRecord &Record) override
Error visitTypeEnd(CVType &Record) override
static Error deserializeAs(CVType &CVT, T &Record)
void consumeError(Error Err)
Consume a Error without doing anything.
static ErrorSuccess success()
Create a success value.
ArrayRef< uint8_t > content() const
Error visitTypeBegin(CVType &Record, TypeIndex Index) override
Error visitMemberEnd(CVMemberRecord &Record) override
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Lightweight error class with error context and mandatory checking.
Provides read only access to a subclass of BinaryStream.
FieldListDeserializer(BinaryStreamReader &Reader)