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))
62 CVType CVT(static_cast<TypeLeafKind>(K), Data);
63 if (
auto EC = deserializeAs<T>(CVT, Record))
69 assert(!Mapping &&
"Already in a type mapping!");
70 Mapping = llvm::make_unique<MappingInfo>(Record.
content());
71 return Mapping->Mapping.visitTypeBegin(Record);
79 assert(Mapping &&
"Not in a type mapping!");
80 auto EC = Mapping->Mapping.visitTypeEnd(Record);
85 #define TYPE_RECORD(EnumName, EnumVal, Name) \ 86 Error visitKnownRecord(CVType &CVR, Name##Record &Record) override { \ 87 return visitKnownRecordImpl<Name##Record>(CVR, Record); \ 89 #define MEMBER_RECORD(EnumName, EnumVal, Name) 90 #define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) 91 #define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) 92 #include "llvm/DebugInfo/CodeView/CodeViewTypes.def" 95 template <
typename RecordType>
97 return Mapping->Mapping.visitKnownRecord(CVR, Record);
100 std::unique_ptr<MappingInfo> Mapping;
106 : Reader(R), Mapping(Reader), StartOffset(0) {}
116 FieldList.
Type = TypeLeafKind::LF_FIELDLIST;
117 consumeError(Mapping.Mapping.visitTypeBegin(FieldList));
122 FieldList.
Type = TypeLeafKind::LF_FIELDLIST;
127 Mapping.StartOffset = Mapping.Reader.getOffset();
128 return Mapping.Mapping.visitMemberBegin(Record);
132 if (
auto EC = Mapping.Mapping.visitMemberEnd(Record))
137 #define TYPE_RECORD(EnumName, EnumVal, Name) 138 #define MEMBER_RECORD(EnumName, EnumVal, Name) \ 139 Error visitKnownMember(CVMemberRecord &CVR, Name##Record &Record) override { \ 140 return visitKnownMemberImpl<Name##Record>(CVR, Record); \ 142 #define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) 143 #define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) 144 #include "llvm/DebugInfo/CodeView/CodeViewTypes.def" 147 template <
typename RecordType>
148 Error visitKnownMemberImpl(CVMemberRecord &CVR, RecordType &Record) {
149 if (
auto EC = Mapping.Mapping.visitKnownMember(CVR, Record))
152 uint32_t EndOffset = Mapping.Reader.getOffset();
153 uint32_t RecordLength = EndOffset - Mapping.StartOffset;
154 Mapping.Reader.setOffset(Mapping.StartOffset);
155 if (
auto EC = Mapping.Reader.readBytes(CVR.Data, RecordLength))
157 assert(Mapping.Reader.getOffset() == EndOffset);
166 #endif // LLVM_DEBUGINFO_CODEVIEW_TYPEDESERIALIZER_H
An implementation of BinaryStream which holds its entire data set in a single contiguous buffer...
This class represents lattice values for constants.
~FieldListDeserializer() override
ArrayRef< uint8_t > content() const
Tagged union holding either a T or a Error.
Error visitTypeBegin(CVType &Record) override
Paired begin/end actions for all types.
TypeDeserializer()=default
TypeRecordKind
Distinguishes individual records in .debug$T or .debug$P 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.
Error visitTypeBegin(CVType &Record, TypeIndex Index) override
Error visitMemberEnd(CVMemberRecord &Record) override
static Expected< T > deserializeAs(ArrayRef< uint8_t > Data)
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)