Skip to content

Commit

Permalink
[codeview] Dump the type index on the first line of each record
Browse files Browse the repository at this point in the history
This will make it easier to write FileCheck tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269444 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
rnk committed May 13, 2016
1 parent 062cef5 commit af223d6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 22 deletions.
4 changes: 2 additions & 2 deletions lib/DebugInfo/CodeView/TypeDumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 4 additions & 8 deletions test/DebugInfo/COFF/inlining.ll
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 3 additions & 6 deletions test/DebugInfo/PDB/pdbdump-headers.test
Original file line number Diff line number Diff line change
Expand Up @@ -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: ]
Expand All @@ -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)
Expand All @@ -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
Expand Down
9 changes: 3 additions & 6 deletions test/tools/llvm-readobj/codeview-vftable.test
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,25 @@

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
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
Expand Down

0 comments on commit af223d6

Please sign in to comment.