diff options
author | Rui Ueyama <ruiu@google.com> | 2016-06-16 14:47:23 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2016-06-16 14:47:23 +0000 |
commit | 43ed08efa30a9626bcddabad4bf78239c48d7f5d (patch) | |
tree | fa589da638ba6f9db7bfa96fae9debb302d774e1 /llvm/lib/DebugInfo/CodeView | |
parent | b9095ae7eeb88a034762c801c0ada054fa38f5dc (diff) | |
download | bcm5719-llvm-43ed08efa30a9626bcddabad4bf78239c48d7f5d.tar.gz bcm5719-llvm-43ed08efa30a9626bcddabad4bf78239c48d7f5d.zip |
[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
llvm-svn: 272899
Diffstat (limited to 'llvm/lib/DebugInfo/CodeView')
-rw-r--r-- | llvm/lib/DebugInfo/CodeView/TypeDumper.cpp | 26 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp | 15 |
2 files changed, 17 insertions, 24 deletions
diff --git a/llvm/lib/DebugInfo/CodeView/TypeDumper.cpp b/llvm/lib/DebugInfo/CodeView/TypeDumper.cpp index 2bf9828ff0b..b181ffb7c4d 100644 --- a/llvm/lib/DebugInfo/CodeView/TypeDumper.cpp +++ b/llvm/lib/DebugInfo/CodeView/TypeDumper.cpp @@ -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(TypeLeafKind LT) { 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::visitUnknownMember(TypeLeafKind Leaf) { 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) { diff --git a/llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp b/llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp index a405d790350..f71a31d6e38 100644 --- a/llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp +++ b/llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp @@ -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(TypeLeafKind Leaf, #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)); |