1; RUN: llc < %s -filetype=obj | llvm-readobj - --codeview | FileCheck %s
2; RUN: llc < %s | llvm-mc -filetype=obj --triple=x86_64-windows | llvm-readobj - --codeview | FileCheck %s
3
4; C++ source to regenerate:
5; $ cat t.cpp
6; struct A { int a; };
7; struct B { int b; };
8; struct C : A, B { int c; };
9; struct D : virtual C { int d; };
10; struct E;
11; int A::*pmd_a;
12; int C::*pmd_b;
13; int D::*pmd_c;
14; int E::*pmd_d;
15; void (A::*pmf_a)();
16; void (C::*pmf_b)();
17; void (D::*pmf_c)();
18; void (E::*pmf_d)();
19; struct Incomplete;
20; int Incomplete::**ppmd;
21; void (Incomplete::**ppmf)();
22; $ clang t.cpp -S -emit-llvm -g -gcodeview -o t.ll
23
24; CHECK: CodeViewTypes [
25
26; Pointer to data member
27
28; CHECK:   Pointer ({{.*}}) {
29; CHECK:     TypeLeafKind: LF_POINTER (0x1002)
30; CHECK:     PointeeType: int (0x74)
31; CHECK:     PtrType: Near64 (0xC)
32; CHECK:     PtrMode: PointerToDataMember (0x2)
33; CHECK:     IsFlat: 0
34; CHECK:     IsConst: 0
35; CHECK:     IsVolatile: 0
36; CHECK:     IsUnaligned: 0
37; CHECK:     SizeOf: 4
38; CHECK:     ClassType: A
39; CHECK:     Representation: SingleInheritanceData (0x1)
40; CHECK:   }
41; CHECK:   Pointer ({{.*}}) {
42; CHECK:     TypeLeafKind: LF_POINTER (0x1002)
43; CHECK:     PointeeType: int (0x74)
44; CHECK:     PtrType: Near64 (0xC)
45; CHECK:     PtrMode: PointerToDataMember (0x2)
46; CHECK:     IsFlat: 0
47; CHECK:     IsConst: 0
48; CHECK:     IsVolatile: 0
49; CHECK:     IsUnaligned: 0
50; CHECK:     SizeOf: 4
51; CHECK:     ClassType: C
52; CHECK:     Representation: MultipleInheritanceData (0x2)
53; CHECK:   }
54; CHECK:   Pointer ({{.*}}) {
55; CHECK:     TypeLeafKind: LF_POINTER (0x1002)
56; CHECK:     PointeeType: int (0x74)
57; CHECK:     PtrType: Near64 (0xC)
58; CHECK:     PtrMode: PointerToDataMember (0x2)
59; CHECK:     IsFlat: 0
60; CHECK:     IsConst: 0
61; CHECK:     IsVolatile: 0
62; CHECK:     IsUnaligned: 0
63; CHECK:     SizeOf: 8
64; CHECK:     ClassType: D
65; CHECK:     Representation: VirtualInheritanceData (0x3)
66; CHECK:   }
67; CHECK:   Pointer ({{.*}}) {
68; CHECK:     TypeLeafKind: LF_POINTER (0x1002)
69; CHECK:     PointeeType: int (0x74)
70; CHECK:     PtrType: Near64 (0xC)
71; CHECK:     PtrMode: PointerToDataMember (0x2)
72; CHECK:     IsFlat: 0
73; CHECK:     IsConst: 0
74; CHECK:     IsVolatile: 0
75; CHECK:     IsUnaligned: 0
76; CHECK:     SizeOf: 12
77; CHECK:     ClassType: E
78; CHECK:     Representation: GeneralData (0x4)
79; CHECK:   }
80
81; Pointer to member function
82
83; CHECK:   Pointer ({{.*}}) {
84; CHECK:     TypeLeafKind: LF_POINTER (0x1002)
85; CHECK:     PointeeType: void A::()
86; CHECK:     PtrType: Near64 (0xC)
87; CHECK:     PtrMode: PointerToMemberFunction (0x3)
88; CHECK:     IsFlat: 0
89; CHECK:     IsConst: 0
90; CHECK:     IsVolatile: 0
91; CHECK:     IsUnaligned: 0
92; CHECK:     SizeOf: 8
93; CHECK:     ClassType: A
94; CHECK:     Representation: SingleInheritanceFunction (0x5)
95; CHECK:   }
96; CHECK:   Pointer ({{.*}}) {
97; CHECK:     TypeLeafKind: LF_POINTER (0x1002)
98; CHECK:     PointeeType: void C::()
99; CHECK:     PtrType: Near64 (0xC)
100; CHECK:     PtrMode: PointerToMemberFunction (0x3)
101; CHECK:     IsFlat: 0
102; CHECK:     IsConst: 0
103; CHECK:     IsVolatile: 0
104; CHECK:     IsUnaligned: 0
105; CHECK:     SizeOf: 16
106; CHECK:     ClassType: C
107; CHECK:     Representation: MultipleInheritanceFunction (0x6)
108; CHECK:   }
109; CHECK:   Pointer ({{.*}}) {
110; CHECK:     TypeLeafKind: LF_POINTER (0x1002)
111; CHECK:     PointeeType: void D::()
112; CHECK:     PtrType: Near64 (0xC)
113; CHECK:     PtrMode: PointerToMemberFunction (0x3)
114; CHECK:     IsFlat: 0
115; CHECK:     IsConst: 0
116; CHECK:     IsVolatile: 0
117; CHECK:     IsUnaligned: 0
118; CHECK:     SizeOf: 16
119; CHECK:     ClassType: D
120; CHECK:     Representation: VirtualInheritanceFunction (0x7)
121; CHECK:   }
122; CHECK:   Pointer ({{.*}}) {
123; CHECK:     TypeLeafKind: LF_POINTER (0x1002)
124; CHECK:     PointeeType: void E::()
125; CHECK:     PtrType: Near64 (0xC)
126; CHECK:     PtrMode: PointerToMemberFunction (0x3)
127; CHECK:     IsFlat: 0
128; CHECK:     IsConst: 0
129; CHECK:     IsVolatile: 0
130; CHECK:     IsUnaligned: 0
131; CHECK:     SizeOf: 24
132; CHECK:     ClassType: E
133; CHECK:     Representation: GeneralFunction (0x8)
134; CHECK:   }
135
136; Unknown inheritance model MPT
137; CHECK:   Pointer ({{.*}}) {
138; CHECK:     TypeLeafKind: LF_POINTER (0x1002)
139; CHECK:     PointeeType: int
140; CHECK:     PtrType: Near64 (0xC)
141; CHECK:     PtrMode: PointerToDataMember (0x2)
142; CHECK:     IsFlat: 0
143; CHECK:     IsConst: 0
144; CHECK:     IsVolatile: 0
145; CHECK:     IsUnaligned: 0
146; CHECK:     SizeOf: 0
147; CHECK:     ClassType: Incomplete
148; CHECK:     Representation: Unknown (0x0)
149; CHECK:   }
150; CHECK:   Pointer ({{.*}}) {
151; CHECK:     TypeLeafKind: LF_POINTER (0x1002)
152; CHECK:   Pointer ({{.*}}) {
153; CHECK:     TypeLeafKind: LF_POINTER (0x1002)
154; CHECK:     PointeeType: void Incomplete::()
155; CHECK:     PtrType: Near64 (0xC)
156; CHECK:     PtrMode: PointerToMemberFunction (0x3)
157; CHECK:     IsFlat: 0
158; CHECK:     IsConst: 0
159; CHECK:     IsVolatile: 0
160; CHECK:     IsUnaligned: 0
161; CHECK:     SizeOf: 0
162; CHECK:     ClassType: Incomplete
163; CHECK:     Representation: Unknown (0x0)
164; CHECK:   }
165; CHECK:   Pointer ({{.*}}) {
166; CHECK:     TypeLeafKind: LF_POINTER (0x1002)
167
168; CHECK: ]
169
170; ModuleID = 't.cpp'
171source_filename = "t.cpp"
172target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
173target triple = "x86_64-pc-windows-msvc19.0.23918"
174
175%0 = type opaque
176%1 = type opaque
177
178@"\01?pmd_a@@3PEQA@@HEQ1@" = global i32 -1, align 8, !dbg !0
179@"\01?pmd_b@@3PEQC@@HEQ1@" = global i32 -1, align 8, !dbg !6
180@"\01?pmd_c@@3PEQD@@HEQ1@" = global { i32, i32 } { i32 0, i32 -1 }, align 8, !dbg !21
181@"\01?pmd_d@@3PEQE@@HEQ1@" = global { i32, i32, i32 } { i32 0, i32 0, i32 -1 }, align 8, !dbg !25
182@"\01?pmf_a@@3P8A@@EAAXXZEQ1@" = global i8* null, align 8, !dbg !29
183@"\01?pmf_b@@3P8C@@EAAXXZEQ1@" = global { i8*, i32 } zeroinitializer, align 8, !dbg !35
184@"\01?pmf_c@@3P8D@@EAAXXZEQ1@" = global { i8*, i32, i32 } zeroinitializer, align 8, !dbg !41
185@"\01?pmf_d@@3P8E@@EAAXXZEQ1@" = global { i8*, i32, i32, i32 } zeroinitializer, align 8, !dbg !47
186@"\01?ppmd@@3PEAPEQIncomplete@@HEA" = global %0* null, align 8, !dbg !53
187@"\01?ppmf@@3PEAP8Incomplete@@EAAXXZEA" = global %1* null, align 8, !dbg !58
188
189!llvm.dbg.cu = !{!2}
190!llvm.module.flags = !{!66, !67, !68}
191!llvm.ident = !{!69}
192
193!0 = distinct !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
194!1 = !DIGlobalVariable(name: "pmd_a", linkageName: "\01?pmd_a@@3PEQA@@HEQ1@", scope: !2, file: !3, line: 6, type: !65, isLocal: false, isDefinition: true)
195!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 3.9.0 (trunk 273036) (llvm/trunk 273053)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)
196!3 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild")
197!4 = !{}
198!5 = !{!0, !6, !21, !25, !29, !35, !41, !47, !53, !58}
199!6 = distinct !DIGlobalVariableExpression(var: !7, expr: !DIExpression())
200!7 = !DIGlobalVariable(name: "pmd_b", linkageName: "\01?pmd_b@@3PEQC@@HEQ1@", scope: !2, file: !3, line: 7, type: !8, isLocal: false, isDefinition: true)
201!8 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !9, size: 32, flags: DIFlagMultipleInheritance, extraData: !10)
202!9 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
203!10 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "C", file: !3, line: 3, size: 96, align: 32, elements: !11, identifier: ".?AUC@@")
204!11 = !{!12, !16, !20}
205!12 = !DIDerivedType(tag: DW_TAG_inheritance, scope: !10, baseType: !13)
206!13 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !3, line: 1, size: 32, align: 32, elements: !14, identifier: ".?AUA@@")
207!14 = !{!15}
208!15 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !13, file: !3, line: 1, baseType: !9, size: 32, align: 32)
209!16 = !DIDerivedType(tag: DW_TAG_inheritance, scope: !10, baseType: !17, offset: 32)
210!17 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "B", file: !3, line: 2, size: 32, align: 32, elements: !18, identifier: ".?AUB@@")
211!18 = !{!19}
212!19 = !DIDerivedType(tag: DW_TAG_member, name: "b", scope: !17, file: !3, line: 2, baseType: !9, size: 32, align: 32)
213!20 = !DIDerivedType(tag: DW_TAG_member, name: "c", scope: !10, file: !3, line: 3, baseType: !9, size: 32, align: 32, offset: 64)
214!21 = distinct !DIGlobalVariableExpression(var: !22, expr: !DIExpression())
215!22 = !DIGlobalVariable(name: "pmd_c", linkageName: "\01?pmd_c@@3PEQD@@HEQ1@", scope: !2, file: !3, line: 8, type: !23, isLocal: false, isDefinition: true)
216!23 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !9, size: 64, flags: DIFlagVirtualInheritance, extraData: !24)
217!24 = !DICompositeType(tag: DW_TAG_structure_type, name: "D", file: !3, line: 4, size: 256, align: 64, flags: DIFlagFwdDecl, identifier: ".?AUD@@")
218!25 = distinct !DIGlobalVariableExpression(var: !26, expr: !DIExpression())
219!26 = !DIGlobalVariable(name: "pmd_d", linkageName: "\01?pmd_d@@3PEQE@@HEQ1@", scope: !2, file: !3, line: 9, type: !27, isLocal: false, isDefinition: true)
220!27 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !9, size: 96, extraData: !28)
221!28 = !DICompositeType(tag: DW_TAG_structure_type, name: "E", file: !3, line: 5, flags: DIFlagFwdDecl, identifier: ".?AUE@@")
222!29 = distinct !DIGlobalVariableExpression(var: !30, expr: !DIExpression())
223!30 = !DIGlobalVariable(name: "pmf_a", linkageName: "\01?pmf_a@@3P8A@@EAAXXZEQ1@", scope: !2, file: !3, line: 10, type: !31, isLocal: false, isDefinition: true)
224!31 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !32, size: 64, flags: DIFlagSingleInheritance, extraData: !13)
225!32 = !DISubroutineType(types: !33)
226!33 = !{null, !34}
227!34 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !13, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
228!35 = distinct !DIGlobalVariableExpression(var: !36, expr: !DIExpression())
229!36 = !DIGlobalVariable(name: "pmf_b", linkageName: "\01?pmf_b@@3P8C@@EAAXXZEQ1@", scope: !2, file: !3, line: 11, type: !37, isLocal: false, isDefinition: true)
230!37 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !38, size: 128, flags: DIFlagMultipleInheritance, extraData: !10)
231!38 = !DISubroutineType(types: !39)
232!39 = !{null, !40}
233!40 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !10, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
234!41 = distinct !DIGlobalVariableExpression(var: !42, expr: !DIExpression())
235!42 = !DIGlobalVariable(name: "pmf_c", linkageName: "\01?pmf_c@@3P8D@@EAAXXZEQ1@", scope: !2, file: !3, line: 12, type: !43, isLocal: false, isDefinition: true)
236!43 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !44, size: 128, flags: DIFlagVirtualInheritance, extraData: !24)
237!44 = !DISubroutineType(types: !45)
238!45 = !{null, !46}
239!46 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !24, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
240!47 = distinct !DIGlobalVariableExpression(var: !48, expr: !DIExpression())
241!48 = !DIGlobalVariable(name: "pmf_d", linkageName: "\01?pmf_d@@3P8E@@EAAXXZEQ1@", scope: !2, file: !3, line: 13, type: !49, isLocal: false, isDefinition: true)
242!49 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !50, size: 192, extraData: !28)
243!50 = !DISubroutineType(types: !51)
244!51 = !{null, !52}
245!52 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !28, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
246!53 = distinct !DIGlobalVariableExpression(var: !54, expr: !DIExpression())
247!54 = !DIGlobalVariable(name: "ppmd", linkageName: "\01?ppmd@@3PEAPEQIncomplete@@HEA", scope: !2, file: !3, line: 15, type: !55, isLocal: false, isDefinition: true)
248!55 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !56, size: 64, align: 64)
249!56 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !9, extraData: !57)
250!57 = !DICompositeType(tag: DW_TAG_structure_type, name: "Incomplete", file: !3, line: 14, flags: DIFlagFwdDecl, identifier: ".?AUIncomplete@@")
251!58 = distinct !DIGlobalVariableExpression(var: !59, expr: !DIExpression())
252!59 = !DIGlobalVariable(name: "ppmf", linkageName: "\01?ppmf@@3PEAP8Incomplete@@EAAXXZEA", scope: !2, file: !3, line: 16, type: !60, isLocal: false, isDefinition: true)
253!60 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !61, size: 64, align: 64)
254!61 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !62, extraData: !57)
255!62 = !DISubroutineType(types: !63)
256!63 = !{null, !64}
257!64 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !57, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
258!65 = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: !9, size: 32, flags: DIFlagSingleInheritance, extraData: !13)
259!66 = !{i32 2, !"CodeView", i32 1}
260!67 = !{i32 2, !"Debug Info Version", i32 3}
261!68 = !{i32 1, !"PIC Level", i32 2}
262!69 = !{!"clang version 3.9.0 (trunk 273036) (llvm/trunk 273053)"}
263
264