xref: /llvm-project/llvm/test/tools/llvm-readobj/COFF/codeview-merging.test (revision dbf520f617440d62ca46f64cdc41159945911902)
1*dbf520f6SGeorgii Rymar# To regenerate t1.obj and t2.obj, run the following:
2*dbf520f6SGeorgii Rymar# $ cat t.cpp
3*dbf520f6SGeorgii Rymar# #ifdef CONFIG1
4*dbf520f6SGeorgii Rymar# struct A;
5*dbf520f6SGeorgii Rymar# struct B {
6*dbf520f6SGeorgii Rymar#   A *a;
7*dbf520f6SGeorgii Rymar# };
8*dbf520f6SGeorgii Rymar# int f(A *a);
9*dbf520f6SGeorgii Rymar# int g(B *b) { return f(b->a); }
10*dbf520f6SGeorgii Rymar# #else
11*dbf520f6SGeorgii Rymar# struct B;
12*dbf520f6SGeorgii Rymar# struct A {
13*dbf520f6SGeorgii Rymar#   B *b;
14*dbf520f6SGeorgii Rymar# };
15*dbf520f6SGeorgii Rymar# int g(B *b);
16*dbf520f6SGeorgii Rymar# int f(A *a) { return g(a->b); }
17*dbf520f6SGeorgii Rymar# #endif
18*dbf520f6SGeorgii Rymar# $ cl -c -DCONFIG1 -Z7 t.cpp -Fot1.obj && cl -c -Z7 t.cpp -Fot2.obj
19*dbf520f6SGeorgii Rymar
20*dbf520f6SGeorgii RymarRUN: llvm-readobj --codeview %S/Inputs/codeview-merging-1.obj | FileCheck %s --check-prefix=OBJ1
21*dbf520f6SGeorgii RymarRUN: llvm-readobj --codeview %S/Inputs/codeview-merging-2.obj | FileCheck %s --check-prefix=OBJ2
22*dbf520f6SGeorgii RymarRUN: llvm-readobj --codeview-merged-types %S/Inputs/codeview-merging-1.obj %S/Inputs/codeview-merging-2.obj | FileCheck %s
23*dbf520f6SGeorgii Rymar
24*dbf520f6SGeorgii RymarOBJ1:       Procedure ({{.*}}) {
25*dbf520f6SGeorgii RymarOBJ1-NEXT:    TypeLeafKind: LF_PROCEDURE (0x1008)
26*dbf520f6SGeorgii RymarOBJ1-NEXT:    ReturnType: int (0x74)
27*dbf520f6SGeorgii RymarOBJ1-NEXT:    CallingConvention: NearC (0x0)
28*dbf520f6SGeorgii RymarOBJ1-NEXT:    FunctionOptions [ (0x0)
29*dbf520f6SGeorgii RymarOBJ1-NEXT:    ]
30*dbf520f6SGeorgii RymarOBJ1-NEXT:    NumParameters: 1
31*dbf520f6SGeorgii RymarOBJ1-NEXT:    ArgListType: (A*) (0x1002)
32*dbf520f6SGeorgii RymarOBJ1-NEXT:  }
33*dbf520f6SGeorgii RymarOBJ1:       FuncId (0x100D) {
34*dbf520f6SGeorgii RymarOBJ1-NEXT:    TypeLeafKind: LF_FUNC_ID (0x1601)
35*dbf520f6SGeorgii RymarOBJ1-NEXT:    ParentScope: 0x0
36*dbf520f6SGeorgii RymarOBJ1-NEXT:    FunctionType: int (B*) (0x100C)
37*dbf520f6SGeorgii RymarOBJ1-NEXT:    Name: g
38*dbf520f6SGeorgii RymarOBJ1-NEXT:  }
39*dbf520f6SGeorgii RymarOBJ1-NEXT:  FuncId (0x100E) {
40*dbf520f6SGeorgii RymarOBJ1-NEXT:    TypeLeafKind: LF_FUNC_ID (0x1601)
41*dbf520f6SGeorgii RymarOBJ1-NEXT:    ParentScope: 0x0
42*dbf520f6SGeorgii RymarOBJ1-NEXT:    FunctionType: int (A*) (0x1003)
43*dbf520f6SGeorgii RymarOBJ1-NEXT:    Name: f
44*dbf520f6SGeorgii RymarOBJ1-NEXT:  }
45*dbf520f6SGeorgii RymarOBJ1-NOT: FuncId
46*dbf520f6SGeorgii Rymar
47*dbf520f6SGeorgii RymarOBJ2:       FuncId (0x100D) {
48*dbf520f6SGeorgii RymarOBJ2-NEXT:    TypeLeafKind: LF_FUNC_ID (0x1601)
49*dbf520f6SGeorgii RymarOBJ2-NEXT:    ParentScope: 0x0
50*dbf520f6SGeorgii RymarOBJ2-NEXT:    FunctionType: int (A*) (0x100C)
51*dbf520f6SGeorgii RymarOBJ2-NEXT:    Name: f
52*dbf520f6SGeorgii RymarOBJ2-NEXT:  }
53*dbf520f6SGeorgii Rymar
54*dbf520f6SGeorgii RymarOBJ2:       FuncId (0x1069) {
55*dbf520f6SGeorgii RymarOBJ2-NEXT:    TypeLeafKind: LF_FUNC_ID (0x1601)
56*dbf520f6SGeorgii RymarOBJ2-NEXT:    ParentScope: 0x0
57*dbf520f6SGeorgii RymarOBJ2-NEXT:    FunctionType: int (B*) (0x1003)
58*dbf520f6SGeorgii RymarOBJ2-NEXT:    Name: g
59*dbf520f6SGeorgii RymarOBJ2-NEXT:  }
60*dbf520f6SGeorgii RymarOBJ2-NOT: FuncId
61*dbf520f6SGeorgii Rymar
62*dbf520f6SGeorgii RymarCHECK: MergedTypeStream [
63*dbf520f6SGeorgii RymarCHECK:       Procedure ({{.*}}) {
64*dbf520f6SGeorgii RymarCHECK-NEXT:    TypeLeafKind: LF_PROCEDURE (0x1008)
65*dbf520f6SGeorgii RymarCHECK-NEXT:    ReturnType: int (0x74)
66*dbf520f6SGeorgii RymarCHECK-NEXT:    CallingConvention: NearC (0x0)
67*dbf520f6SGeorgii RymarCHECK-NEXT:    FunctionOptions [ (0x0)
68*dbf520f6SGeorgii RymarCHECK-NEXT:    ]
69*dbf520f6SGeorgii RymarCHECK-NEXT:    NumParameters: 1
70*dbf520f6SGeorgii RymarCHECK-NEXT:    ArgListType: (A*) (0x1002)
71*dbf520f6SGeorgii RymarCHECK-NEXT:  }
72*dbf520f6SGeorgii RymarCHECK:       Struct (0x1007) {
73*dbf520f6SGeorgii RymarCHECK-NEXT:    TypeLeafKind: LF_STRUCTURE (0x1505)
74*dbf520f6SGeorgii RymarCHECK-NEXT:    MemberCount: 1
75*dbf520f6SGeorgii RymarCHECK-NEXT:    Properties [ (0x200)
76*dbf520f6SGeorgii RymarCHECK-NEXT:      HasUniqueName (0x200)
77*dbf520f6SGeorgii RymarCHECK-NEXT:    ]
78*dbf520f6SGeorgii RymarCHECK-NEXT:    FieldList: <field list> (0x1006)
79*dbf520f6SGeorgii RymarCHECK-NEXT:    DerivedFrom: 0x0
80*dbf520f6SGeorgii RymarCHECK-NEXT:    VShape: 0x0
81*dbf520f6SGeorgii RymarCHECK-NEXT:    SizeOf: 8
82*dbf520f6SGeorgii RymarCHECK-NEXT:    Name: B
83*dbf520f6SGeorgii RymarCHECK-NEXT:    LinkageName: .?AUB@@
84*dbf520f6SGeorgii RymarCHECK-NEXT:  }
85*dbf520f6SGeorgii RymarCHECK: ]
86*dbf520f6SGeorgii Rymar
87*dbf520f6SGeorgii RymarCHECK: MergedIDStream [
88*dbf520f6SGeorgii RymarCHECK-NEXT:  StringId (0x1000) {
89*dbf520f6SGeorgii RymarCHECK-NEXT:    TypeLeafKind: LF_STRING_ID (0x1605)
90*dbf520f6SGeorgii RymarCHECK-NEXT:    Id: 0x0
91*dbf520f6SGeorgii RymarCHECK-NEXT:    StringData: d:\src\llvm\build\t.cpp
92*dbf520f6SGeorgii RymarCHECK-NEXT:  }
93*dbf520f6SGeorgii Rymar# Test that we contextually dump item ids and type ids from different databases.
94*dbf520f6SGeorgii RymarCHECK-NEXT:  UdtSourceLine (0x1001) {
95*dbf520f6SGeorgii RymarCHECK-NEXT:    TypeLeafKind: LF_UDT_SRC_LINE (0x1606)
96*dbf520f6SGeorgii RymarCHECK-NEXT:    UDT: B (0x1007)
97*dbf520f6SGeorgii RymarCHECK-NEXT:    SourceFile: d:\src\llvm\build\t.cpp (0x1000)
98*dbf520f6SGeorgii RymarCHECK-NEXT:    LineNumber: 3
99*dbf520f6SGeorgii RymarCHECK-NEXT:  }
100*dbf520f6SGeorgii RymarCHECK:       FuncId (0x1002) {
101*dbf520f6SGeorgii RymarCHECK-NEXT:    TypeLeafKind: LF_FUNC_ID (0x1601)
102*dbf520f6SGeorgii RymarCHECK-NEXT:    ParentScope: 0x0
103*dbf520f6SGeorgii RymarCHECK-NEXT:    FunctionType: int (B*)
104*dbf520f6SGeorgii RymarCHECK-NEXT:    Name: g
105*dbf520f6SGeorgii RymarCHECK-NEXT:  }
106*dbf520f6SGeorgii RymarCHECK-NEXT:  FuncId (0x1003) {
107*dbf520f6SGeorgii RymarCHECK-NEXT:    TypeLeafKind: LF_FUNC_ID (0x1601)
108*dbf520f6SGeorgii RymarCHECK-NEXT:    ParentScope: 0x0
109*dbf520f6SGeorgii RymarCHECK-NEXT:    FunctionType: int (A*)
110*dbf520f6SGeorgii RymarCHECK-NEXT:    Name: f
111*dbf520f6SGeorgii RymarCHECK-NEXT:  }
112*dbf520f6SGeorgii RymarCHECK-NOT: FuncId
113*dbf520f6SGeorgii RymarCHECK: ]
114