Skip to content

Commit 8321ba5

Browse files
author
Zachary Turner
committed
Write the TPI stream from a PDB to Yaml.
Reviewed By: ruiu, rnk Differential Revision: https://reviews.llvm.org/D23226 llvm-svn: 278869
1 parent a36f4a2 commit 8321ba5

28 files changed

+2059
-260
lines changed

llvm/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class CVTypeVisitor {
2828
/// Visits the type records in Data. Sets the error flag on parse failures.
2929
Error visitTypeStream(const CVTypeArray &Types);
3030

31+
Error visitFieldListMemberStream(ArrayRef<uint8_t> FieldList);
32+
3133
private:
3234
/// The interface to the class that gets notified of each visitation.
3335
TypeVisitorCallbacks &Callbacks;

llvm/include/llvm/DebugInfo/CodeView/EnumTables.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
namespace llvm {
2121
namespace codeview {
2222
ArrayRef<EnumEntry<SymbolKind>> getSymbolTypeNames();
23+
ArrayRef<EnumEntry<TypeLeafKind>> getTypeLeafNames();
2324
ArrayRef<EnumEntry<uint16_t>> getRegisterNames();
2425
ArrayRef<EnumEntry<uint8_t>> getProcSymFlagNames();
2526
ArrayRef<EnumEntry<uint16_t>> getLocalFlagNames();

llvm/include/llvm/DebugInfo/CodeView/TypeDeserializer.h

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

1616
namespace llvm {
1717
namespace codeview {
18-
class TypeDeserializerBase : public TypeVisitorCallbacks {
18+
class TypeDeserializer : public TypeVisitorCallbacks {
1919
public:
20-
explicit TypeDeserializerBase(TypeVisitorCallbacks &Recipient)
20+
explicit TypeDeserializer(TypeVisitorCallbacks &Recipient)
2121
: Recipient(Recipient) {}
2222

2323
Error visitTypeBegin(const CVRecord<TypeLeafKind> &Record) override {
@@ -62,39 +62,6 @@ class TypeDeserializerBase : public TypeVisitorCallbacks {
6262
return Recipient.visitKnownRecord(CVR, Record);
6363
}
6464
};
65-
66-
class TypeDeserializer : public TypeDeserializerBase {
67-
public:
68-
explicit TypeDeserializer(TypeVisitorCallbacks &Recipient)
69-
: TypeDeserializerBase(Recipient) {}
70-
71-
/// FieldList records need special handling. For starters, they do not
72-
/// describe their own length, so a different extraction algorithm is
73-
/// necessary. Secondly, a single FieldList record will result in the
74-
/// deserialization of many records. So even though the top level visitor
75-
/// calls visitFieldBegin() on a single record, multiple records get visited
76-
/// through the callback interface.
77-
Error visitKnownRecord(const CVRecord<TypeLeafKind> &CVR,
78-
FieldListRecord &Record) override;
79-
80-
private:
81-
template <typename T>
82-
Error visitKnownMember(ArrayRef<uint8_t> &Data, TypeLeafKind Kind,
83-
T &Record) {
84-
ArrayRef<uint8_t> OldData = Data;
85-
if (auto EC = deserializeRecord(Data, Kind, Record))
86-
return EC;
87-
assert(Data.size() < OldData.size());
88-
89-
CVRecord<TypeLeafKind> CVR;
90-
CVR.Length = OldData.size() - Data.size();
91-
CVR.Data = OldData.slice(0, CVR.Length);
92-
CVR.RawData = CVR.Data;
93-
return Recipient.visitKnownRecord(CVR, Record);
94-
}
95-
96-
Error skipPadding(ArrayRef<uint8_t> &Data);
97-
};
9865
}
9966
}
10067

llvm/include/llvm/DebugInfo/CodeView/TypeDumper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class CVTypeDumper : public TypeVisitorCallbacks {
8787

8888
ScopedPrinter *W;
8989

90+
bool IsInFieldList = false;
9091
bool PrintRecordBytes = false;
9192

9293
/// Name of the current type. Only valid before visitTypeEnd.

0 commit comments

Comments
 (0)