OSDN Git Service

[DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.
[android-x86/external-llvm.git] / test / DebugInfo / COFF / defer-complete-type.ll
1 ; RUN: llc < %s -filetype=obj | llvm-readobj - -codeview | FileCheck %s
2
3 ; Both A and B should get forward declarations and complete definitions for this
4 ; example.
5
6 ; C++ source to regenerate:
7 ; $ cat t.cpp
8 ; struct B { int b; };
9 ; struct A { B *b; };
10 ; int f(A *p) { return p->b->b; }
11 ; $ clang t.cpp -S -emit-llvm -g -gcodeview -o t.ll
12
13 ; CHECK: CodeViewTypes [
14 ; CHECK:   Section: .debug$T (6)
15 ; CHECK:   Magic: 0x4
16 ; CHECK:   Struct (0x1000) {
17 ; CHECK:     TypeLeafKind: LF_STRUCTURE (0x1505)
18 ; CHECK:     MemberCount: 0
19 ; CHECK:     Properties [ (0x280)
20 ; CHECK:       ForwardReference (0x80)
21 ; CHECK:       HasUniqueName (0x200)
22 ; CHECK:     ]
23 ; CHECK:     FieldList: 0x0
24 ; CHECK:     DerivedFrom: 0x0
25 ; CHECK:     VShape: 0x0
26 ; CHECK:     SizeOf: 0
27 ; CHECK:     Name: A
28 ; CHECK:     LinkageName: .?AUA@@
29 ; CHECK:   }
30 ; CHECK:   Pointer (0x1001) {
31 ; CHECK:     TypeLeafKind: LF_POINTER (0x1002)
32 ; CHECK:     PointeeType: A (0x1000)
33 ; CHECK:     PointerAttributes: 0x1000C
34 ; CHECK:     PtrType: Near64 (0xC)
35 ; CHECK:     PtrMode: Pointer (0x0)
36 ; CHECK:     IsFlat: 0
37 ; CHECK:     IsConst: 0
38 ; CHECK:     IsVolatile: 0
39 ; CHECK:     IsUnaligned: 0
40 ; CHECK:     SizeOf: 8
41 ; CHECK:   }
42 ; CHECK:   ArgList (0x1002) {
43 ; CHECK:     TypeLeafKind: LF_ARGLIST (0x1201)
44 ; CHECK:     NumArgs: 1
45 ; CHECK:     Arguments [
46 ; CHECK:       ArgType: A* (0x1001)
47 ; CHECK:     ]
48 ; CHECK:   }
49 ; CHECK:   Procedure (0x1003) {
50 ; CHECK:     TypeLeafKind: LF_PROCEDURE (0x1008)
51 ; CHECK:     ReturnType: int (0x74)
52 ; CHECK:     CallingConvention: NearC (0x0)
53 ; CHECK:     FunctionOptions [ (0x0)
54 ; CHECK:     ]
55 ; CHECK:     NumParameters: 1
56 ; CHECK:     ArgListType: (A*) (0x1002)
57 ; CHECK:   }
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)
64 ; CHECK:     ]
65 ; CHECK:     FieldList: 0x0
66 ; CHECK:     DerivedFrom: 0x0
67 ; CHECK:     VShape: 0x0
68 ; CHECK:     SizeOf: 0
69 ; CHECK:     Name: B
70 ; CHECK:     LinkageName: .?AUB@@
71 ; CHECK:   }
72 ; CHECK:   Pointer (0x1005) {
73 ; CHECK:     TypeLeafKind: LF_POINTER (0x1002)
74 ; CHECK:     PointeeType: B (0x1004)
75 ; CHECK:     PointerAttributes: 0x1000C
76 ; CHECK:     PtrType: Near64 (0xC)
77 ; CHECK:     PtrMode: Pointer (0x0)
78 ; CHECK:     IsFlat: 0
79 ; CHECK:     IsConst: 0
80 ; CHECK:     IsVolatile: 0
81 ; CHECK:     IsUnaligned: 0
82 ; CHECK:     SizeOf: 8
83 ; CHECK:   }
84 ; CHECK:   FieldList (0x1006) {
85 ; CHECK:     TypeLeafKind: LF_FIELDLIST (0x1203)
86 ; CHECK:     DataMember {
87 ; CHECK:       AccessSpecifier: Public (0x3)
88 ; CHECK:       Type: B* (0x1005)
89 ; CHECK:       FieldOffset: 0x0
90 ; CHECK:       Name: b
91 ; CHECK:     }
92 ; CHECK:   }
93 ; CHECK:   Struct (0x1007) {
94 ; CHECK:     TypeLeafKind: LF_STRUCTURE (0x1505)
95 ; CHECK:     MemberCount: 1
96 ; CHECK:     Properties [ (0x200)
97 ; CHECK:       HasUniqueName (0x200)
98 ; CHECK:     ]
99 ; CHECK:     FieldList: <field list> (0x1006)
100 ; CHECK:     DerivedFrom: 0x0
101 ; CHECK:     VShape: 0x0
102 ; CHECK:     SizeOf: 8
103 ; CHECK:     Name: A
104 ; CHECK:     LinkageName: .?AUA@@
105 ; CHECK:   }
106 ; CHECK:   StringId (0x1008) {
107 ; CHECK:     TypeLeafKind: LF_STRING_ID (0x1605)
108 ; CHECK:     Id: 0x0
109 ; CHECK:     StringData: D:\src\llvm\build\t.cpp
110 ; CHECK:   }
111 ; CHECK:   UdtSourceLine (0x1009) {
112 ; CHECK:     TypeLeafKind: LF_UDT_SRC_LINE (0x1606)
113 ; CHECK:     UDT: A (0x1007)
114 ; CHECK:     SourceFile: D:\src\llvm\build\t.cpp (0x1008)
115 ; CHECK:     LineNumber: 2
116 ; CHECK:   }
117 ; CHECK:   FieldList (0x100A) {
118 ; CHECK:     TypeLeafKind: LF_FIELDLIST (0x1203)
119 ; CHECK:     DataMember {
120 ; CHECK:       AccessSpecifier: Public (0x3)
121 ; CHECK:       Type: int (0x74)
122 ; CHECK:       FieldOffset: 0x0
123 ; CHECK:       Name: b
124 ; CHECK:     }
125 ; CHECK:   }
126 ; CHECK:   Struct (0x100B) {
127 ; CHECK:     TypeLeafKind: LF_STRUCTURE (0x1505)
128 ; CHECK:     MemberCount: 1
129 ; CHECK:     Properties [ (0x200)
130 ; CHECK:       HasUniqueName (0x200)
131 ; CHECK:     ]
132 ; CHECK:     FieldList: <field list> (0x100A)
133 ; CHECK:     DerivedFrom: 0x0
134 ; CHECK:     VShape: 0x0
135 ; CHECK:     SizeOf: 4
136 ; CHECK:     Name: B
137 ; CHECK:     LinkageName: .?AUB@@
138 ; CHECK:   }
139 ; CHECK:   UdtSourceLine (0x100C) {
140 ; CHECK:     TypeLeafKind: LF_UDT_SRC_LINE (0x1606)
141 ; CHECK:     UDT: B (0x100B)
142 ; CHECK:     SourceFile: D:\src\llvm\build\t.cpp (0x1008)
143 ; CHECK:     LineNumber: 1
144 ; CHECK:   }
145 ; CHECK:   FuncId (0x100D) {
146 ; CHECK:     TypeLeafKind: LF_FUNC_ID (0x1601)
147 ; CHECK:     ParentScope: 0x0
148 ; CHECK:     FunctionType: int (A*) (0x1003)
149 ; CHECK:     Name: f
150 ; CHECK:   }
151 ; CHECK: ]
152
153 ; ModuleID = 't.cpp'
154 source_filename = "t.cpp"
155 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
156 target triple = "x86_64-pc-windows-msvc19.0.23918"
157
158 %struct.A = type { %struct.B* }
159 %struct.B = type { i32 }
160
161 ; Function Attrs: nounwind uwtable
162 define i32 @"\01?f@@YAHPEAUA@@@Z"(%struct.A* %p) #0 !dbg !7 {
163 entry:
164   %p.addr = alloca %struct.A*, align 8
165   store %struct.A* %p, %struct.A** %p.addr, align 8
166   call void @llvm.dbg.declare(metadata %struct.A** %p.addr, metadata !19, metadata !20), !dbg !21
167   %0 = load %struct.A*, %struct.A** %p.addr, align 8, !dbg !22
168   %b = getelementptr inbounds %struct.A, %struct.A* %0, i32 0, i32 0, !dbg !23
169   %1 = load %struct.B*, %struct.B** %b, align 8, !dbg !23
170   %b1 = getelementptr inbounds %struct.B, %struct.B* %1, i32 0, i32 0, !dbg !24
171   %2 = load i32, i32* %b1, align 4, !dbg !24
172   ret i32 %2, !dbg !25
173 }
174
175 ; Function Attrs: nounwind readnone
176 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
177
178 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" }
179 attributes #1 = { nounwind readnone }
180
181 !llvm.dbg.cu = !{!0}
182 !llvm.module.flags = !{!3, !4, !5}
183 !llvm.ident = !{!6}
184
185 !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)
186 !1 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild")
187 !2 = !{}
188 !3 = !{i32 2, !"CodeView", i32 1}
189 !4 = !{i32 2, !"Debug Info Version", i32 3}
190 !5 = !{i32 1, !"PIC Level", i32 2}
191 !6 = !{!"clang version 3.9.0 "}
192 !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)
193 !8 = !DISubroutineType(types: !9)
194 !9 = !{!10, !11}
195 !10 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
196 !11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !12, size: 64, align: 64)
197 !12 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !1, line: 2, size: 64, align: 64, elements: !13, identifier: ".?AUA@@")
198 !13 = !{!14}
199 !14 = !DIDerivedType(tag: DW_TAG_member, name: "b", scope: !12, file: !1, line: 2, baseType: !15, size: 64, align: 64)
200 !15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !16, size: 64, align: 64)
201 !16 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "B", file: !1, line: 1, size: 32, align: 32, elements: !17, identifier: ".?AUB@@")
202 !17 = !{!18}
203 !18 = !DIDerivedType(tag: DW_TAG_member, name: "b", scope: !16, file: !1, line: 1, baseType: !10, size: 32, align: 32)
204 !19 = !DILocalVariable(name: "p", arg: 1, scope: !7, file: !1, line: 3, type: !11)
205 !20 = !DIExpression()
206 !21 = !DILocation(line: 3, column: 10, scope: !7)
207 !22 = !DILocation(line: 3, column: 22, scope: !7)
208 !23 = !DILocation(line: 3, column: 25, scope: !7)
209 !24 = !DILocation(line: 3, column: 28, scope: !7)
210 !25 = !DILocation(line: 3, column: 15, scope: !7)