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
4 ; Both A and B should get forward declarations and complete definitions for this
7 ; C++ source to regenerate:
11 ; int f(A *p) { return p->b->b; }
12 ; $ clang t.cpp -S -emit-llvm -g -gcodeview -o t.ll
14 ; CHECK: CodeViewTypes [
15 ; CHECK: Section: .debug$T (6)
17 ; CHECK: Struct (0x1000) {
18 ; CHECK: TypeLeafKind: LF_STRUCTURE (0x1505)
19 ; CHECK: MemberCount: 0
20 ; CHECK: Properties [ (0x280)
21 ; CHECK: ForwardReference (0x80)
22 ; CHECK: HasUniqueName (0x200)
24 ; CHECK: FieldList: 0x0
25 ; CHECK: DerivedFrom: 0x0
29 ; CHECK: LinkageName: .?AUA@@
31 ; CHECK: Pointer (0x1001) {
32 ; CHECK: TypeLeafKind: LF_POINTER (0x1002)
33 ; CHECK: PointeeType: A (0x1000)
34 ; CHECK: PtrType: Near64 (0xC)
35 ; CHECK: PtrMode: Pointer (0x0)
38 ; CHECK: IsVolatile: 0
39 ; CHECK: IsUnaligned: 0
42 ; CHECK: ArgList (0x1002) {
43 ; CHECK: TypeLeafKind: LF_ARGLIST (0x1201)
46 ; CHECK: ArgType: A* (0x1001)
49 ; CHECK: Procedure (0x1003) {
50 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
51 ; CHECK: ReturnType: int (0x74)
52 ; CHECK: CallingConvention: NearC (0x0)
53 ; CHECK: FunctionOptions [ (0x0)
55 ; CHECK: NumParameters: 1
56 ; CHECK: ArgListType: (A*) (0x1002)
58 ; CHECK: Struct (0x1004) {
59 ; CHECK: TypeLeafKind: LF_STRUCTURE (0x1505)
60 ; CHECK: MemberCount: 0
61 ; CHECK: Properties [ (0x280)
62 ; CHECK: ForwardReference (0x80)
63 ; CHECK: HasUniqueName (0x200)
65 ; CHECK: FieldList: 0x0
66 ; CHECK: DerivedFrom: 0x0
70 ; CHECK: LinkageName: .?AUB@@
72 ; CHECK: Pointer (0x1005) {
73 ; CHECK: TypeLeafKind: LF_POINTER (0x1002)
74 ; CHECK: PointeeType: B (0x1004)
75 ; CHECK: PtrType: Near64 (0xC)
76 ; CHECK: PtrMode: Pointer (0x0)
79 ; CHECK: IsVolatile: 0
80 ; CHECK: IsUnaligned: 0
83 ; CHECK: FieldList (0x1006) {
84 ; CHECK: TypeLeafKind: LF_FIELDLIST (0x1203)
86 ; CHECK: AccessSpecifier: Public (0x3)
87 ; CHECK: Type: B* (0x1005)
88 ; CHECK: FieldOffset: 0x0
92 ; CHECK: Struct (0x1007) {
93 ; CHECK: TypeLeafKind: LF_STRUCTURE (0x1505)
94 ; CHECK: MemberCount: 1
95 ; CHECK: Properties [ (0x200)
96 ; CHECK: HasUniqueName (0x200)
98 ; CHECK: FieldList: <field list> (0x1006)
99 ; CHECK: DerivedFrom: 0x0
103 ; CHECK: LinkageName: .?AUA@@
105 ; CHECK: StringId (0x1008) {
106 ; CHECK: TypeLeafKind: LF_STRING_ID (0x1605)
108 ; CHECK: StringData: D:\src\llvm\build\t.cpp
110 ; CHECK: UdtSourceLine (0x1009) {
111 ; CHECK: TypeLeafKind: LF_UDT_SRC_LINE (0x1606)
112 ; CHECK: UDT: A (0x1007)
113 ; CHECK: SourceFile: D:\src\llvm\build\t.cpp (0x1008)
114 ; CHECK: LineNumber: 2
116 ; CHECK: FieldList (0x100A) {
117 ; CHECK: TypeLeafKind: LF_FIELDLIST (0x1203)
118 ; CHECK: DataMember {
119 ; CHECK: AccessSpecifier: Public (0x3)
120 ; CHECK: Type: int (0x74)
121 ; CHECK: FieldOffset: 0x0
125 ; CHECK: Struct (0x100B) {
126 ; CHECK: TypeLeafKind: LF_STRUCTURE (0x1505)
127 ; CHECK: MemberCount: 1
128 ; CHECK: Properties [ (0x200)
129 ; CHECK: HasUniqueName (0x200)
131 ; CHECK: FieldList: <field list> (0x100A)
132 ; CHECK: DerivedFrom: 0x0
136 ; CHECK: LinkageName: .?AUB@@
138 ; CHECK: UdtSourceLine (0x100C) {
139 ; CHECK: TypeLeafKind: LF_UDT_SRC_LINE (0x1606)
140 ; CHECK: UDT: B (0x100B)
141 ; CHECK: SourceFile: D:\src\llvm\build\t.cpp (0x1008)
142 ; CHECK: LineNumber: 1
144 ; CHECK: FuncId (0x100D) {
145 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
146 ; CHECK: ParentScope: 0x0
147 ; CHECK: FunctionType: int (A*) (0x1003)
153 source_filename = "t.cpp"
154 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
155 target triple = "x86_64-pc-windows-msvc19.0.23918"
157 %struct.A = type { %struct.B* }
158 %struct.B = type { i32 }
160 ; Function Attrs: nounwind uwtable
161 define i32 @"\01?f@@YAHPEAUA@@@Z"(%struct.A* %p) #0 !dbg !7 {
163 %p.addr = alloca %struct.A*, align 8
164 store %struct.A* %p, %struct.A** %p.addr, align 8
165 call void @llvm.dbg.declare(metadata %struct.A** %p.addr, metadata !19, metadata !20), !dbg !21
166 %0 = load %struct.A*, %struct.A** %p.addr, align 8, !dbg !22
167 %b = getelementptr inbounds %struct.A, %struct.A* %0, i32 0, i32 0, !dbg !23
168 %1 = load %struct.B*, %struct.B** %b, align 8, !dbg !23
169 %b1 = getelementptr inbounds %struct.B, %struct.B* %1, i32 0, i32 0, !dbg !24
170 %2 = load i32, i32* %b1, align 4, !dbg !24
174 ; Function Attrs: nounwind readnone
175 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
177 attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
178 attributes #1 = { nounwind readnone }
181 !llvm.module.flags = !{!3, !4, !5}
184 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.9.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
185 !1 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild")
187 !3 = !{i32 2, !"CodeView", i32 1}
188 !4 = !{i32 2, !"Debug Info Version", i32 3}
189 !5 = !{i32 1, !"PIC Level", i32 2}
190 !6 = !{!"clang version 3.9.0 "}
191 !7 = distinct !DISubprogram(name: "f", linkageName: "\01?f@@YAHPEAUA@@@Z", scope: !1, file: !1, line: 3, type: !8, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
192 !8 = !DISubroutineType(types: !9)
194 !10 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
195 !11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !12, size: 64, align: 64)
196 !12 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !1, line: 2, size: 64, align: 64, elements: !13, identifier: ".?AUA@@")
198 !14 = !DIDerivedType(tag: DW_TAG_member, name: "b", scope: !12, file: !1, line: 2, baseType: !15, size: 64, align: 64)
199 !15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !16, size: 64, align: 64)
200 !16 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "B", file: !1, line: 1, size: 32, align: 32, elements: !17, identifier: ".?AUB@@")
202 !18 = !DIDerivedType(tag: DW_TAG_member, name: "b", scope: !16, file: !1, line: 1, baseType: !10, size: 32, align: 32)
203 !19 = !DILocalVariable(name: "p", arg: 1, scope: !7, file: !1, line: 3, type: !11)
204 !20 = !DIExpression()
205 !21 = !DILocation(line: 3, column: 10, scope: !7)
206 !22 = !DILocation(line: 3, column: 22, scope: !7)
207 !23 = !DILocation(line: 3, column: 25, scope: !7)
208 !24 = !DILocation(line: 3, column: 28, scope: !7)
209 !25 = !DILocation(line: 3, column: 15, scope: !7)