[llvm] r272899 - [codeview] Pass CVRecord to visitTypeBegin callback.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 16 07:47:23 PDT 2016
Author: ruiu
Date: Thu Jun 16 09:47:23 2016
New Revision: 272899
URL: http://llvm.org/viewvc/llvm-project?rev=272899&view=rev
Log:
[codeview] Pass CVRecord to visitTypeBegin callback.
Both parameters to visitTypeBegin are actually members of CVRecord,
so we can just pass CVRecord instead of destructuring it.
Differential Revision: http://reviews.llvm.org/D21435
Modified:
llvm/trunk/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h
llvm/trunk/lib/DebugInfo/CodeView/TypeDumper.cpp
llvm/trunk/lib/DebugInfo/CodeView/TypeStreamMerger.cpp
llvm/trunk/lib/DebugInfo/PDB/Raw/TpiStream.cpp
Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h?rev=272899&r1=272898&r2=272899&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h Thu Jun 16 09:47:23 2016
@@ -52,12 +52,11 @@ public:
void visitTypeRecord(const CVRecord<TypeLeafKind> &Record) {
ArrayRef<uint8_t> LeafData = Record.Data;
- ArrayRef<uint8_t> RecordData = LeafData;
auto *DerivedThis = static_cast<Derived *>(this);
- DerivedThis->visitTypeBegin(Record.Type, RecordData);
+ DerivedThis->visitTypeBegin(Record);
switch (Record.Type) {
default:
- DerivedThis->visitUnknownType(Record.Type, RecordData);
+ DerivedThis->visitUnknownType(Record);
break;
case LF_FIELDLIST:
DerivedThis->visitFieldList(Record.Type, LeafData);
@@ -76,7 +75,7 @@ public:
#define MEMBER_RECORD(EnumName, EnumVal, Name)
#include "TypeRecords.def"
}
- DerivedThis->visitTypeEnd(Record.Type, RecordData);
+ DerivedThis->visitTypeEnd(Record);
}
/// Visits the type records in Data. Sets the error flag on parse failures.
@@ -89,12 +88,12 @@ public:
}
/// Action to take on unknown types. By default, they are ignored.
- void visitUnknownType(TypeLeafKind Leaf, ArrayRef<uint8_t> RecordData) {}
+ void visitUnknownType(const CVRecord<TypeLeafKind> &Record) {}
/// Paired begin/end actions for all types. Receives all record data,
/// including the fixed-length record prefix.
- void visitTypeBegin(TypeLeafKind Leaf, ArrayRef<uint8_t> RecordData) {}
- void visitTypeEnd(TypeLeafKind Leaf, ArrayRef<uint8_t> RecordData) {}
+ void visitTypeBegin(const CVRecord<TypeLeafKind> &Record) {}
+ void visitTypeEnd(const CVRecord<TypeLeafKind> &Record) {}
ArrayRef<uint8_t> skipPadding(ArrayRef<uint8_t> Data) {
if (Data.empty())
Modified: llvm/trunk/lib/DebugInfo/CodeView/TypeDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/TypeDumper.cpp?rev=272899&r1=272898&r2=272899&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/CodeView/TypeDumper.cpp (original)
+++ llvm/trunk/lib/DebugInfo/CodeView/TypeDumper.cpp Thu Jun 16 09:47:23 2016
@@ -209,10 +209,10 @@ public:
#include "llvm/DebugInfo/CodeView/TypeRecords.def"
void visitUnknownMember(TypeLeafKind Leaf);
- void visitUnknownType(TypeLeafKind Leaf, ArrayRef<uint8_t> LeafData);
+ void visitUnknownType(const CVRecord<TypeLeafKind> &Record);
- void visitTypeBegin(TypeLeafKind Leaf, ArrayRef<uint8_t> LeafData);
- void visitTypeEnd(TypeLeafKind Leaf, ArrayRef<uint8_t> LeafData);
+ void visitTypeBegin(const CVRecord<TypeLeafKind> &Record);
+ void visitTypeEnd(const CVRecord<TypeLeafKind> &Record);
void printMemberAttributes(MemberAttributes Attrs);
void printMemberAttributes(MemberAccess Access, MethodKind Kind,
@@ -250,25 +250,22 @@ static StringRef getLeafTypeName(TypeLea
return "UnknownLeaf";
}
-void CVTypeDumperImpl::visitTypeBegin(TypeLeafKind Leaf,
- ArrayRef<uint8_t> LeafData) {
+void CVTypeDumperImpl::visitTypeBegin(const CVRecord<TypeLeafKind> &Rec) {
// Reset Name to the empty string. If the visitor sets it, we know it.
Name = "";
- W.startLine() << getLeafTypeName(Leaf) << " ("
+ W.startLine() << getLeafTypeName(Rec.Type) << " ("
<< HexNumber(CVTD.getNextTypeIndex()) << ") {\n";
W.indent();
- W.printEnum("TypeLeafKind", unsigned(Leaf), makeArrayRef(LeafTypeNames));
+ W.printEnum("TypeLeafKind", unsigned(Rec.Type), makeArrayRef(LeafTypeNames));
}
-void CVTypeDumperImpl::visitTypeEnd(TypeLeafKind Leaf,
- ArrayRef<uint8_t> LeafData) {
+void CVTypeDumperImpl::visitTypeEnd(const CVRecord<TypeLeafKind> &Rec) {
// Always record some name for every type, even if Name is empty. CVUDTNames
// is indexed by type index, and must have one entry for every type.
CVTD.recordType(Name);
-
if (PrintRecordBytes)
- W.printBinaryBlock("LeafData", getBytesAsCharacters(LeafData));
+ W.printBinaryBlock("LeafData", getBytesAsCharacters(Rec.Data));
W.unindent();
W.startLine() << "}\n";
@@ -545,11 +542,10 @@ void CVTypeDumperImpl::visitUnknownMembe
W.printHex("UnknownMember", unsigned(Leaf));
}
-void CVTypeDumperImpl::visitUnknownType(TypeLeafKind Leaf,
- ArrayRef<uint8_t> RecordData) {
+void CVTypeDumperImpl::visitUnknownType(const CVRecord<TypeLeafKind> &Rec) {
DictScope S(W, "UnknownType");
- W.printEnum("Kind", uint16_t(Leaf), makeArrayRef(LeafTypeNames));
- W.printNumber("Length", uint32_t(RecordData.size()));
+ W.printEnum("Kind", uint16_t(Rec.Type), makeArrayRef(LeafTypeNames));
+ W.printNumber("Length", uint32_t(Rec.Data.size()));
}
void CVTypeDumperImpl::visitNestedType(NestedTypeRecord &Nested) {
Modified: llvm/trunk/lib/DebugInfo/CodeView/TypeStreamMerger.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/TypeStreamMerger.cpp?rev=272899&r1=272898&r2=272899&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/CodeView/TypeStreamMerger.cpp (original)
+++ llvm/trunk/lib/DebugInfo/CodeView/TypeStreamMerger.cpp Thu Jun 16 09:47:23 2016
@@ -64,10 +64,10 @@ public:
#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
#include "llvm/DebugInfo/CodeView/TypeRecords.def"
- void visitUnknownType(TypeLeafKind Leaf, ArrayRef<uint8_t> RecordData);
+ void visitUnknownType(const CVRecord<TypeLeafKind> &Record);
- void visitTypeBegin(TypeLeafKind Leaf, ArrayRef<uint8_t> RecordData);
- void visitTypeEnd(TypeLeafKind Leaf, ArrayRef<uint8_t> RecordData);
+ void visitTypeBegin(const CVRecord<TypeLeafKind> &Record);
+ void visitTypeEnd(const CVRecord<TypeLeafKind> &Record);
void visitFieldList(TypeLeafKind Leaf, ArrayRef<uint8_t> FieldData);
@@ -91,13 +91,11 @@ private:
} // end anonymous namespace
-void TypeStreamMerger::visitTypeBegin(TypeLeafKind Leaf,
- ArrayRef<uint8_t> RecordData) {
+void TypeStreamMerger::visitTypeBegin(const CVRecord<TypeLeafKind> &Rec) {
BeginIndexMapSize = IndexMap.size();
}
-void TypeStreamMerger::visitTypeEnd(TypeLeafKind Leaf,
- ArrayRef<uint8_t> RecordData) {
+void TypeStreamMerger::visitTypeEnd(const CVRecord<TypeLeafKind> &Rec) {
assert(IndexMap.size() == BeginIndexMapSize + 1);
}
@@ -122,8 +120,7 @@ void TypeStreamMerger::visitFieldList(Ty
#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
#include "llvm/DebugInfo/CodeView/TypeRecords.def"
-void TypeStreamMerger::visitUnknownType(TypeLeafKind Leaf,
- ArrayRef<uint8_t> RecordData) {
+void TypeStreamMerger::visitUnknownType(const CVRecord<TypeLeafKind> &Rec) {
// We failed to translate a type. Translate this index as "not translated".
IndexMap.push_back(
TypeIndex(SimpleTypeKind::NotTranslated, SimpleTypeMode::Direct));
Modified: llvm/trunk/lib/DebugInfo/PDB/Raw/TpiStream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Raw/TpiStream.cpp?rev=272899&r1=272898&r2=272899&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Raw/TpiStream.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Raw/TpiStream.cpp Thu Jun 16 09:47:23 2016
@@ -102,9 +102,7 @@ public:
void visitStruct(ClassRecord &Rec) { verify(Rec); }
void visitUnion(UnionRecord &Rec) { verify(Rec); }
- void visitTypeEnd(TypeLeafKind Leaf, ArrayRef<uint8_t> RecordData) {
- ++Index;
- }
+ void visitTypeEnd(const CVRecord<TypeLeafKind> &Record) { ++Index; }
private:
template <typename T> void verify(T &Rec) {
More information about the llvm-commits
mailing list