Index: include/llvm/DebugInfo/CodeView/CVTypeVisitor.h =================================================================== --- include/llvm/DebugInfo/CodeView/CVTypeVisitor.h +++ include/llvm/DebugInfo/CodeView/CVTypeVisitor.h @@ -52,12 +52,11 @@ void visitTypeRecord(const CVRecord &Record) { ArrayRef LeafData = Record.Data; - ArrayRef RecordData = LeafData; auto *DerivedThis = static_cast(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 @@ #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 @@ } /// Action to take on unknown types. By default, they are ignored. - void visitUnknownType(TypeLeafKind Leaf, ArrayRef RecordData) {} + void visitUnknownType(const CVRecord &Record) {} /// Paired begin/end actions for all types. Receives all record data, /// including the fixed-length record prefix. - void visitTypeBegin(TypeLeafKind Leaf, ArrayRef RecordData) {} - void visitTypeEnd(TypeLeafKind Leaf, ArrayRef RecordData) {} + void visitTypeBegin(const CVRecord &Record) {} + void visitTypeEnd(const CVRecord &Record) {} ArrayRef skipPadding(ArrayRef Data) { if (Data.empty()) Index: lib/DebugInfo/CodeView/TypeDumper.cpp =================================================================== --- lib/DebugInfo/CodeView/TypeDumper.cpp +++ lib/DebugInfo/CodeView/TypeDumper.cpp @@ -209,10 +209,10 @@ #include "llvm/DebugInfo/CodeView/TypeRecords.def" void visitUnknownMember(TypeLeafKind Leaf); - void visitUnknownType(TypeLeafKind Leaf, ArrayRef LeafData); + void visitUnknownType(const CVRecord &Record); - void visitTypeBegin(TypeLeafKind Leaf, ArrayRef LeafData); - void visitTypeEnd(TypeLeafKind Leaf, ArrayRef LeafData); + void visitTypeBegin(const CVRecord &Record); + void visitTypeEnd(const CVRecord &Record); void printMemberAttributes(MemberAttributes Attrs); void printMemberAttributes(MemberAccess Access, MethodKind Kind, @@ -250,25 +250,22 @@ return "UnknownLeaf"; } -void CVTypeDumperImpl::visitTypeBegin(TypeLeafKind Leaf, - ArrayRef LeafData) { +void CVTypeDumperImpl::visitTypeBegin(const CVRecord &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 LeafData) { +void CVTypeDumperImpl::visitTypeEnd(const CVRecord &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"; @@ -555,11 +552,10 @@ W.printHex("UnknownMember", unsigned(Leaf)); } -void CVTypeDumperImpl::visitUnknownType(TypeLeafKind Leaf, - ArrayRef RecordData) { +void CVTypeDumperImpl::visitUnknownType(const CVRecord &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(TypeLeafKind Leaf, Index: lib/DebugInfo/CodeView/TypeStreamMerger.cpp =================================================================== --- lib/DebugInfo/CodeView/TypeStreamMerger.cpp +++ lib/DebugInfo/CodeView/TypeStreamMerger.cpp @@ -64,10 +64,10 @@ #define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) #include "llvm/DebugInfo/CodeView/TypeRecords.def" - void visitUnknownType(TypeLeafKind Leaf, ArrayRef RecordData); + void visitUnknownType(const CVRecord &Record); - void visitTypeBegin(TypeLeafKind Leaf, ArrayRef RecordData); - void visitTypeEnd(TypeLeafKind Leaf, ArrayRef RecordData); + void visitTypeBegin(const CVRecord &Record); + void visitTypeEnd(const CVRecord &Record); void visitFieldList(TypeLeafKind Leaf, ArrayRef FieldData); @@ -91,13 +91,11 @@ } // end anonymous namespace -void TypeStreamMerger::visitTypeBegin(TypeLeafKind Leaf, - ArrayRef RecordData) { +void TypeStreamMerger::visitTypeBegin(const CVRecord &Rec) { BeginIndexMapSize = IndexMap.size(); } -void TypeStreamMerger::visitTypeEnd(TypeLeafKind Leaf, - ArrayRef RecordData) { +void TypeStreamMerger::visitTypeEnd(const CVRecord &Rec) { assert(IndexMap.size() == BeginIndexMapSize + 1); } @@ -124,8 +122,7 @@ #define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) #include "llvm/DebugInfo/CodeView/TypeRecords.def" -void TypeStreamMerger::visitUnknownType(TypeLeafKind Leaf, - ArrayRef RecordData) { +void TypeStreamMerger::visitUnknownType(const CVRecord &Rec) { // We failed to translate a type. Translate this index as "not translated". IndexMap.push_back( TypeIndex(SimpleTypeKind::NotTranslated, SimpleTypeMode::Direct)); Index: lib/DebugInfo/PDB/Raw/TpiStream.cpp =================================================================== --- lib/DebugInfo/PDB/Raw/TpiStream.cpp +++ lib/DebugInfo/PDB/Raw/TpiStream.cpp @@ -104,9 +104,7 @@ void visitStruct(TypeLeafKind, ClassRecord &Rec) { verify(Rec); } void visitUnion(TypeLeafKind, UnionRecord &Rec) { verify(Rec); } - void visitTypeEnd(TypeLeafKind Leaf, ArrayRef RecordData) { - ++Index; - } + void visitTypeEnd(const CVRecord &Record) { ++Index; } private: template void verify(T &Rec) {