1 ; RUN: llc -mtriple=x86_64-apple-macosx10.7 %s -o %t -filetype=obj
2 ; RUN: llvm-dwarfdump -debug-info %t | FileCheck %s
5 ; CHECK-NOT: AT_bit_size
7 %struct.bar = type { %struct.baz, ptr }
8 %struct.baz = type { i32 }
10 define i32 @main(i32 %argc, ptr %argv) uwtable ssp !dbg !29 {
12 %retval = alloca i32, align 4
13 %argc.addr = alloca i32, align 4
14 %argv.addr = alloca ptr, align 8
15 %myBar = alloca %struct.bar, align 8
16 store i32 0, ptr %retval
17 store i32 %argc, ptr %argc.addr, align 4
18 call void @llvm.dbg.declare(metadata ptr %argc.addr, metadata !49, metadata !DIExpression()), !dbg !50
19 store ptr %argv, ptr %argv.addr, align 8
20 call void @llvm.dbg.declare(metadata ptr %argv.addr, metadata !51, metadata !DIExpression()), !dbg !52
21 call void @llvm.dbg.declare(metadata ptr %myBar, metadata !53, metadata !DIExpression()), !dbg !55
22 call void @_ZN3barC1Ei(ptr %myBar, i32 1), !dbg !56
26 declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
28 define linkonce_odr void @_ZN3barC1Ei(ptr %this, i32 %x) unnamed_addr uwtable ssp align 2 !dbg !37 {
30 %this.addr = alloca ptr, align 8
31 %x.addr = alloca i32, align 4
32 store ptr %this, ptr %this.addr, align 8
33 call void @llvm.dbg.declare(metadata ptr %this.addr, metadata !58, metadata !DIExpression()), !dbg !59
34 store i32 %x, ptr %x.addr, align 4
35 call void @llvm.dbg.declare(metadata ptr %x.addr, metadata !60, metadata !DIExpression()), !dbg !61
36 %this1 = load ptr, ptr %this.addr
37 %0 = load i32, ptr %x.addr, align 4, !dbg !62
38 call void @_ZN3barC2Ei(ptr %this1, i32 %0), !dbg !62
42 define linkonce_odr void @_ZN3barC2Ei(ptr %this, i32 %x) unnamed_addr uwtable ssp align 2 !dbg !40 {
44 %this.addr = alloca ptr, align 8
45 %x.addr = alloca i32, align 4
46 store ptr %this, ptr %this.addr, align 8
47 call void @llvm.dbg.declare(metadata ptr %this.addr, metadata !63, metadata !DIExpression()), !dbg !64
48 store i32 %x, ptr %x.addr, align 4
49 call void @llvm.dbg.declare(metadata ptr %x.addr, metadata !65, metadata !DIExpression()), !dbg !66
50 %this1 = load ptr, ptr %this.addr
51 %0 = load i32, ptr %x.addr, align 4, !dbg !67
52 call void @_ZN3bazC1Ei(ptr %this1, i32 %0), !dbg !67
53 %1 = getelementptr inbounds %struct.bar, ptr %this1, i32 0, i32 1, !dbg !67
54 store ptr %this1, ptr %1, align 8, !dbg !67
58 define linkonce_odr void @_ZN3bazC1Ei(ptr %this, i32 %a) unnamed_addr uwtable ssp align 2 !dbg !43 {
60 %this.addr = alloca ptr, align 8
61 %a.addr = alloca i32, align 4
62 store ptr %this, ptr %this.addr, align 8
63 call void @llvm.dbg.declare(metadata ptr %this.addr, metadata !70, metadata !DIExpression()), !dbg !71
64 store i32 %a, ptr %a.addr, align 4
65 call void @llvm.dbg.declare(metadata ptr %a.addr, metadata !72, metadata !DIExpression()), !dbg !73
66 %this1 = load ptr, ptr %this.addr
67 %0 = load i32, ptr %a.addr, align 4, !dbg !74
68 call void @_ZN3bazC2Ei(ptr %this1, i32 %0), !dbg !74
72 define linkonce_odr void @_ZN3bazC2Ei(ptr %this, i32 %a) unnamed_addr nounwind uwtable ssp align 2 !dbg !46 {
74 %this.addr = alloca ptr, align 8
75 %a.addr = alloca i32, align 4
76 store ptr %this, ptr %this.addr, align 8
77 call void @llvm.dbg.declare(metadata ptr %this.addr, metadata !75, metadata !DIExpression()), !dbg !76
78 store i32 %a, ptr %a.addr, align 4
79 call void @llvm.dbg.declare(metadata ptr %a.addr, metadata !77, metadata !DIExpression()), !dbg !78
80 %this1 = load ptr, ptr %this.addr
81 %0 = load i32, ptr %a.addr, align 4, !dbg !79
82 store i32 %0, ptr %this1, align 4, !dbg !79
87 !llvm.module.flags = !{!83}
89 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.1 (trunk 146596)", isOptimized: false, emissionKind: FullDebug, file: !82, enums: !1, retainedTypes: !3, globals: !1, imports: !1)
92 !5 = !DICompositeType(tag: DW_TAG_class_type, name: "bar", line: 9, size: 128, align: 64, file: !82, elements: !7)
93 !6 = !DIFile(filename: "main.cpp", directory: "/Users/echristo/tmp/bad-struct-ref")
95 !8 = !DIDerivedType(tag: DW_TAG_member, name: "b", line: 11, size: 32, align: 32, file: !82, scope: !5, baseType: !9)
96 !9 = !DICompositeType(tag: DW_TAG_class_type, name: "baz", line: 3, size: 32, align: 32, file: !82, elements: !10)
98 !11 = !DIDerivedType(tag: DW_TAG_member, name: "h", line: 5, size: 32, align: 32, file: !82, scope: !9, baseType: !12)
99 !12 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
100 !13 = !DISubprogram(name: "baz", line: 6, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, file: !82, scope: !9, type: !14)
101 !14 = !DISubroutineType(types: !15)
102 !15 = !{null, !16, !12}
103 !16 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial, baseType: !9)
104 !19 = !DIDerivedType(tag: DW_TAG_member, name: "b_ref", line: 12, size: 64, align: 64, offset: 64, file: !82, scope: !5, baseType: !20)
105 !20 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !9)
106 !21 = !DISubprogram(name: "bar", line: 13, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, file: !82, scope: !5, type: !22)
107 !22 = !DISubroutineType(types: !23)
108 !23 = !{null, !24, !12}
109 !24 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial, baseType: !5)
110 !29 = distinct !DISubprogram(name: "main", line: 17, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, file: !82, scope: !6, type: !30)
111 !30 = !DISubroutineType(types: !31)
112 !31 = !{!12, !12, !32}
113 !32 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !33)
114 !33 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !34)
115 !34 = !DIBasicType(tag: DW_TAG_base_type, name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
117 !36 = !{} ; previously: invalid DW_TAG_base_type
118 !37 = distinct !DISubprogram(name: "bar", linkageName: "_ZN3barC1Ei", line: 13, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, file: !82, scope: null, type: !22, declaration: !21)
120 !39 = !{} ; previously: invalid DW_TAG_base_type
121 !40 = distinct !DISubprogram(name: "bar", linkageName: "_ZN3barC2Ei", line: 13, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, file: !82, scope: null, type: !22, declaration: !21)
123 !42 = !{} ; previously: invalid DW_TAG_base_type
124 !43 = distinct !DISubprogram(name: "baz", linkageName: "_ZN3bazC1Ei", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, file: !82, scope: null, type: !14, declaration: !13)
126 !45 = !{} ; previously: invalid DW_TAG_base_type
127 !46 = distinct !DISubprogram(name: "baz", linkageName: "_ZN3bazC2Ei", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, file: !82, scope: null, type: !14, declaration: !13)
128 !49 = !DILocalVariable(name: "argc", line: 16, arg: 1, scope: !29, file: !6, type: !12)
129 !50 = !DILocation(line: 16, column: 14, scope: !29)
130 !51 = !DILocalVariable(name: "argv", line: 16, arg: 2, scope: !29, file: !6, type: !32)
131 !52 = !DILocation(line: 16, column: 27, scope: !29)
132 !53 = !DILocalVariable(name: "myBar", line: 18, scope: !54, file: !6, type: !5)
133 !54 = distinct !DILexicalBlock(line: 17, column: 1, file: !82, scope: !29)
134 !55 = !DILocation(line: 18, column: 9, scope: !54)
135 !56 = !DILocation(line: 18, column: 17, scope: !54)
136 !57 = !DILocation(line: 19, column: 5, scope: !54)
137 !58 = !DILocalVariable(name: "this", line: 13, arg: 1, flags: DIFlagArtificial, scope: !37, file: !6, type: !24)
138 !59 = !DILocation(line: 13, column: 5, scope: !37)
139 !60 = !DILocalVariable(name: "x", line: 13, arg: 2, scope: !37, file: !6, type: !12)
140 !61 = !DILocation(line: 13, column: 13, scope: !37)
141 !62 = !DILocation(line: 13, column: 34, scope: !37)
142 !63 = !DILocalVariable(name: "this", line: 13, arg: 1, flags: DIFlagArtificial, scope: !40, file: !6, type: !24)
143 !64 = !DILocation(line: 13, column: 5, scope: !40)
144 !65 = !DILocalVariable(name: "x", line: 13, arg: 2, scope: !40, file: !6, type: !12)
145 !66 = !DILocation(line: 13, column: 13, scope: !40)
146 !67 = !DILocation(line: 13, column: 33, scope: !40)
147 !68 = !DILocation(line: 13, column: 34, scope: !69)
148 !69 = distinct !DILexicalBlock(line: 13, column: 33, file: !82, scope: !40)
149 !70 = !DILocalVariable(name: "this", line: 6, arg: 1, flags: DIFlagArtificial, scope: !43, file: !6, type: !16)
150 !71 = !DILocation(line: 6, column: 5, scope: !43)
151 !72 = !DILocalVariable(name: "a", line: 6, arg: 2, scope: !43, file: !6, type: !12)
152 !73 = !DILocation(line: 6, column: 13, scope: !43)
153 !74 = !DILocation(line: 6, column: 24, scope: !43)
154 !75 = !DILocalVariable(name: "this", line: 6, arg: 1, flags: DIFlagArtificial, scope: !46, file: !6, type: !16)
155 !76 = !DILocation(line: 6, column: 5, scope: !46)
156 !77 = !DILocalVariable(name: "a", line: 6, arg: 2, scope: !46, file: !6, type: !12)
157 !78 = !DILocation(line: 6, column: 13, scope: !46)
158 !79 = !DILocation(line: 6, column: 23, scope: !46)
159 !80 = !DILocation(line: 6, column: 24, scope: !81)
160 !81 = distinct !DILexicalBlock(line: 6, column: 23, file: !82, scope: !46)
161 !82 = !DIFile(filename: "main.cpp", directory: "/Users/echristo/tmp/bad-struct-ref")
162 !83 = !{i32 1, !"Debug Info Version", i32 3}