[codeview] Dump the type index on the first line of each record

This will make it easier to write FileCheck tests.

llvm-svn: 269444
This commit is contained in:
Reid Kleckner 2016-05-13 17:48:24 +00:00
parent 97ae10c67c
commit bab3fab806
4 changed files with 12 additions and 22 deletions

View File

@ -254,10 +254,10 @@ void CVTypeDumperImpl::visitTypeBegin(TypeLeafKind Leaf,
// Reset Name to the empty string. If the visitor sets it, we know it.
Name = "";
W.startLine() << getLeafTypeName(Leaf) << " {\n";
W.startLine() << getLeafTypeName(Leaf) << " ("
<< HexNumber(CVTD.getNextTypeIndex()) << ") {\n";
W.indent();
W.printEnum("TypeLeafKind", unsigned(Leaf), makeArrayRef(LeafTypeNames));
W.printHex("TypeIndex", CVTD.getNextTypeIndex());
}
void CVTypeDumperImpl::visitTypeEnd(TypeLeafKind Leaf,

View File

@ -72,28 +72,24 @@
; We should only the LF_FUNC_ID records that we needed to reference.
; OBJ: CodeViewTypes [
; OBJ: Section: .debug$T (4)
; OBJ: ArgList {
; OBJ: ArgList (0x1000) {
; OBJ: TypeLeafKind: LF_ARGLIST (0x1201)
; OBJ: TypeIndex: 0x1000
; OBJ: NumArgs: 0
; OBJ: }
; OBJ: ProcedureType {
; OBJ: ProcedureType (0x1001) {
; OBJ: TypeLeafKind: LF_PROCEDURE (0x1008)
; OBJ: TypeIndex: 0x1001
; OBJ: ReturnType: void (0x3)
; OBJ: NumParameters: 0
; OBJ: ArgListType: () (0x1000)
; OBJ: }
; OBJ: FuncId {
; OBJ: FuncId (0x1002) {
; OBJ: TypeLeafKind: LF_FUNC_ID (0x1601)
; OBJ: TypeIndex: 0x1002
; OBJ: ParentScope: 0x0
; OBJ: FunctionType: void () (0x1001)
; OBJ: Name: bar
; OBJ: }
; OBJ: FuncId {
; OBJ: FuncId (0x1003) {
; OBJ: TypeLeafKind: LF_FUNC_ID (0x1601)
; OBJ: TypeIndex: 0x1003
; OBJ: ParentScope: 0x0
; OBJ: FunctionType: void () (0x1001)
; OBJ: Name: foo

View File

@ -246,9 +246,8 @@
; EMPTY-NEXT: Record count: 75
; EMPTY-NEXT: Records [
; EMPTY-NEXT: {
; EMPTY-NEXT: ArgList {
; EMPTY-NEXT: ArgList (0x1000) {
; EMPTY-NEXT: TypeLeafKind: LF_ARGLIST (0x1201)
; EMPTY-NEXT: TypeIndex: 0x1000
; EMPTY-NEXT: NumArgs: 0
; EMPTY-NEXT: Arguments [
; EMPTY-NEXT: ]
@ -258,9 +257,8 @@
; EMPTY-NEXT: )
; EMPTY-NEXT: }
; EMPTY-NEXT: {
; EMPTY-NEXT: ProcedureType {
; EMPTY-NEXT: ProcedureType (0x1001) {
; EMPTY-NEXT: TypeLeafKind: LF_PROCEDURE (0x1008)
; EMPTY-NEXT: TypeIndex: 0x1001
; EMPTY-NEXT: ReturnType: int (0x74)
; EMPTY-NEXT: CallingConvention: NearC (0x0)
; EMPTY-NEXT: FunctionOptions [ (0x0)
@ -273,9 +271,8 @@
; EMPTY-NEXT: )
; EMPTY-NEXT: }
; EMPTY-NEXT: {
; EMPTY-NEXT: UnknownLeaf {
; EMPTY-NEXT: UnknownLeaf (0x1002) {
; EMPTY-NEXT: TypeLeafKind: LF_FIELDLIST (0x1203)
; EMPTY-NEXT: TypeIndex: 0x1002
; EMPTY-NEXT: Enumerator {
; EMPTY-NEXT: AccessSpecifier: Public (0x3)
; EMPTY-NEXT: EnumValue: 1

View File

@ -19,18 +19,16 @@
RUN: llvm-readobj -codeview %p/Inputs/codeview-vftable.obj.coff | FileCheck %s
CHECK: VFTableType {
CHECK: VFTableType (0x10F0) {
CHECK-NEXT: TypeLeafKind: LF_VFTABLE (0x151D)
CHECK-NEXT: TypeIndex: 0x10F0
CHECK-NEXT: CompleteClass: A
CHECK-NEXT: OverriddenVFTable: 0x0
CHECK-NEXT: VFPtrOffset: 0x0
CHECK-NEXT: VFTableName: ??_7A@@6B@
CHECK-NEXT: MethodName: ?f@A@@UEAAXXZ
CHECK-NEXT: }
CHECK-NEXT: VFTableType {
CHECK-NEXT: VFTableType (0x10F1) {
CHECK-NEXT: TypeLeafKind: LF_VFTABLE (0x151D)
CHECK-NEXT: TypeIndex: 0x10F1
CHECK-NEXT: CompleteClass: B
CHECK-NEXT: OverriddenVFTable: ??_7A@@6B@ (0x10F0)
CHECK-NEXT: VFPtrOffset: 0x0
@ -38,9 +36,8 @@ CHECK-NEXT: VFTableName: ??_7B@@6B@
CHECK-NEXT: MethodName: ?f@B@@UEAAXXZ
CHECK-NEXT: MethodName: ?g@B@@UEAAXXZ
CHECK-NEXT: }
CHECK-NEXT: VFTableType {
CHECK-NEXT: VFTableType (0x10F2) {
CHECK-NEXT: TypeLeafKind: LF_VFTABLE (0x151D)
CHECK-NEXT: TypeIndex: 0x10F2
CHECK-NEXT: CompleteClass: C
CHECK-NEXT: OverriddenVFTable: ??_7B@@6B@ (0x10F1)
CHECK-NEXT: VFPtrOffset: 0x0