aboutsummaryrefslogtreecommitdiffstats
path: root/test/DebugInfo/X86/2011-12-16-BadStructRef.ll
blob: ff9f06cc1ffdfeeb55759f59a50d678a6a4a44ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
; RUN: llc -mtriple=x86_64-apple-macosx10.7 %s -o %t -filetype=obj
; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s

; CHECK: b_ref
; CHECK-NOT: AT_bit_size

%struct.bar = type { %struct.baz, %struct.baz* }
%struct.baz = type { i32 }

define i32 @main(i32 %argc, i8** %argv) uwtable ssp {
entry:
  %retval = alloca i32, align 4
  %argc.addr = alloca i32, align 4
  %argv.addr = alloca i8**, align 8
  %myBar = alloca %struct.bar, align 8
  store i32 0, i32* %retval
  store i32 %argc, i32* %argc.addr, align 4
  call void @llvm.dbg.declare(metadata i32* %argc.addr, metadata !49, metadata !MDExpression()), !dbg !50
  store i8** %argv, i8*** %argv.addr, align 8
  call void @llvm.dbg.declare(metadata i8*** %argv.addr, metadata !51, metadata !MDExpression()), !dbg !52
  call void @llvm.dbg.declare(metadata %struct.bar* %myBar, metadata !53, metadata !MDExpression()), !dbg !55
  call void @_ZN3barC1Ei(%struct.bar* %myBar, i32 1), !dbg !56
  ret i32 0, !dbg !57
}

declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone

define linkonce_odr void @_ZN3barC1Ei(%struct.bar* %this, i32 %x) unnamed_addr uwtable ssp align 2 {
entry:
  %this.addr = alloca %struct.bar*, align 8
  %x.addr = alloca i32, align 4
  store %struct.bar* %this, %struct.bar** %this.addr, align 8
  call void @llvm.dbg.declare(metadata %struct.bar** %this.addr, metadata !58, metadata !MDExpression()), !dbg !59
  store i32 %x, i32* %x.addr, align 4
  call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !60, metadata !MDExpression()), !dbg !61
  %this1 = load %struct.bar*, %struct.bar** %this.addr
  %0 = load i32, i32* %x.addr, align 4, !dbg !62
  call void @_ZN3barC2Ei(%struct.bar* %this1, i32 %0), !dbg !62
  ret void, !dbg !62
}

define linkonce_odr void @_ZN3barC2Ei(%struct.bar* %this, i32 %x) unnamed_addr uwtable ssp align 2 {
entry:
  %this.addr = alloca %struct.bar*, align 8
  %x.addr = alloca i32, align 4
  store %struct.bar* %this, %struct.bar** %this.addr, align 8
  call void @llvm.dbg.declare(metadata %struct.bar** %this.addr, metadata !63, metadata !MDExpression()), !dbg !64
  store i32 %x, i32* %x.addr, align 4
  call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !65, metadata !MDExpression()), !dbg !66
  %this1 = load %struct.bar*, %struct.bar** %this.addr
  %b = getelementptr inbounds %struct.bar, %struct.bar* %this1, i32 0, i32 0, !dbg !67
  %0 = load i32, i32* %x.addr, align 4, !dbg !67
  call void @_ZN3bazC1Ei(%struct.baz* %b, i32 %0), !dbg !67
  %1 = getelementptr inbounds %struct.bar, %struct.bar* %this1, i32 0, i32 1, !dbg !67
  %b2 = getelementptr inbounds %struct.bar, %struct.bar* %this1, i32 0, i32 0, !dbg !67
  store %struct.baz* %b2, %struct.baz** %1, align 8, !dbg !67
  ret void, !dbg !68
}

define linkonce_odr void @_ZN3bazC1Ei(%struct.baz* %this, i32 %a) unnamed_addr uwtable ssp align 2 {
entry:
  %this.addr = alloca %struct.baz*, align 8
  %a.addr = alloca i32, align 4
  store %struct.baz* %this, %struct.baz** %this.addr, align 8
  call void @llvm.dbg.declare(metadata %struct.baz** %this.addr, metadata !70, metadata !MDExpression()), !dbg !71
  store i32 %a, i32* %a.addr, align 4
  call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !72, metadata !MDExpression()), !dbg !73
  %this1 = load %struct.baz*, %struct.baz** %this.addr
  %0 = load i32, i32* %a.addr, align 4, !dbg !74
  call void @_ZN3bazC2Ei(%struct.baz* %this1, i32 %0), !dbg !74
  ret void, !dbg !74
}

define linkonce_odr void @_ZN3bazC2Ei(%struct.baz* %this, i32 %a) unnamed_addr nounwind uwtable ssp align 2 {
entry:
  %this.addr = alloca %struct.baz*, align 8
  %a.addr = alloca i32, align 4
  store %struct.baz* %this, %struct.baz** %this.addr, align 8
  call void @llvm.dbg.declare(metadata %struct.baz** %this.addr, metadata !75, metadata !MDExpression()), !dbg !76
  store i32 %a, i32* %a.addr, align 4
  call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !77, metadata !MDExpression()), !dbg !78
  %this1 = load %struct.baz*, %struct.baz** %this.addr
  %h = getelementptr inbounds %struct.baz, %struct.baz* %this1, i32 0, i32 0, !dbg !79
  %0 = load i32, i32* %a.addr, align 4, !dbg !79
  store i32 %0, i32* %h, align 4, !dbg !79
  ret void, !dbg !80
}

!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!83}

!0 = !MDCompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.1 (trunk 146596)", isOptimized: false, emissionKind: 0, file: !82, enums: !1, retainedTypes: !3, subprograms: !27, globals: !1, imports:  !1)
!1 = !{}
!3 = !{!5, !9}
!5 = !MDCompositeType(tag: DW_TAG_class_type, name: "bar", line: 9, size: 128, align: 64, file: !82, elements: !7)
!6 = !MDFile(filename: "main.cpp", directory: "/Users/echristo/tmp/bad-struct-ref")
!7 = !{!8, !19, !21}
!8 = !MDDerivedType(tag: DW_TAG_member, name: "b", line: 11, size: 32, align: 32, file: !82, scope: !5, baseType: !9)
!9 = !MDCompositeType(tag: DW_TAG_class_type, name: "baz", line: 3, size: 32, align: 32, file: !82, elements: !10)
!10 = !{!11, !13}
!11 = !MDDerivedType(tag: DW_TAG_member, name: "h", line: 5, size: 32, align: 32, file: !82, scope: !9, baseType: !12)
!12 = !MDBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!13 = !MDSubprogram(name: "baz", line: 6, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, file: !82, scope: !9, type: !14)
!14 = !MDSubroutineType(types: !15)
!15 = !{null, !16, !12}
!16 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial, baseType: !9)
!19 = !MDDerivedType(tag: DW_TAG_member, name: "b_ref", line: 12, size: 64, align: 64, offset: 64, file: !82, scope: !5, baseType: !20)
!20 = !MDDerivedType(tag: DW_TAG_reference_type, baseType: !9)
!21 = !MDSubprogram(name: "bar", line: 13, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, file: !82, scope: !5, type: !22)
!22 = !MDSubroutineType(types: !23)
!23 = !{null, !24, !12}
!24 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial, baseType: !5)
!27 = !{!29, !37, !40, !43, !46}
!29 = !MDSubprogram(name: "main", line: 17, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, file: !82, scope: !6, type: !30, function: i32 (i32, i8**)* @main)
!30 = !MDSubroutineType(types: !31)
!31 = !{!12, !12, !32}
!32 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !33)
!33 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !34)
!34 = !MDBasicType(tag: DW_TAG_base_type, name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
!35 = !{!36}
!36 = !{} ; previously: invalid DW_TAG_base_type
!37 = !MDSubprogram(name: "bar", linkageName: "_ZN3barC1Ei", line: 13, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, file: !82, scope: null, type: !22, function: void (%struct.bar*, i32)* @_ZN3barC1Ei, declaration: !21)
!38 = !{!39}
!39 = !{} ; previously: invalid DW_TAG_base_type
!40 = !MDSubprogram(name: "bar", linkageName: "_ZN3barC2Ei", line: 13, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, file: !82, scope: null, type: !22, function: void (%struct.bar*, i32)* @_ZN3barC2Ei, declaration: !21)
!41 = !{!42}
!42 = !{} ; previously: invalid DW_TAG_base_type
!43 = !MDSubprogram(name: "baz", linkageName: "_ZN3bazC1Ei", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, file: !82, scope: null, type: !14, function: void (%struct.baz*, i32)* @_ZN3bazC1Ei, declaration: !13)
!44 = !{!45}
!45 = !{} ; previously: invalid DW_TAG_base_type
!46 = !MDSubprogram(name: "baz", linkageName: "_ZN3bazC2Ei", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, file: !82, scope: null, type: !14, function: void (%struct.baz*, i32)* @_ZN3bazC2Ei, declaration: !13)
!49 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "argc", line: 16, arg: 1, scope: !29, file: !6, type: !12)
!50 = !MDLocation(line: 16, column: 14, scope: !29)
!51 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "argv", line: 16, arg: 2, scope: !29, file: !6, type: !32)
!52 = !MDLocation(line: 16, column: 27, scope: !29)
!53 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "myBar", line: 18, scope: !54, file: !6, type: !5)
!54 = distinct !MDLexicalBlock(line: 17, column: 1, file: !82, scope: !29)
!55 = !MDLocation(line: 18, column: 9, scope: !54)
!56 = !MDLocation(line: 18, column: 17, scope: !54)
!57 = !MDLocation(line: 19, column: 5, scope: !54)
!58 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", line: 13, arg: 1, flags: DIFlagArtificial, scope: !37, file: !6, type: !24)
!59 = !MDLocation(line: 13, column: 5, scope: !37)
!60 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "x", line: 13, arg: 2, scope: !37, file: !6, type: !12)
!61 = !MDLocation(line: 13, column: 13, scope: !37)
!62 = !MDLocation(line: 13, column: 34, scope: !37)
!63 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", line: 13, arg: 1, flags: DIFlagArtificial, scope: !40, file: !6, type: !24)
!64 = !MDLocation(line: 13, column: 5, scope: !40)
!65 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "x", line: 13, arg: 2, scope: !40, file: !6, type: !12)
!66 = !MDLocation(line: 13, column: 13, scope: !40)
!67 = !MDLocation(line: 13, column: 33, scope: !40)
!68 = !MDLocation(line: 13, column: 34, scope: !69)
!69 = distinct !MDLexicalBlock(line: 13, column: 33, file: !82, scope: !40)
!70 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", line: 6, arg: 1, flags: DIFlagArtificial, scope: !43, file: !6, type: !16)
!71 = !MDLocation(line: 6, column: 5, scope: !43)
!72 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "a", line: 6, arg: 2, scope: !43, file: !6, type: !12)
!73 = !MDLocation(line: 6, column: 13, scope: !43)
!74 = !MDLocation(line: 6, column: 24, scope: !43)
!75 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", line: 6, arg: 1, flags: DIFlagArtificial, scope: !46, file: !6, type: !16)
!76 = !MDLocation(line: 6, column: 5, scope: !46)
!77 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "a", line: 6, arg: 2, scope: !46, file: !6, type: !12)
!78 = !MDLocation(line: 6, column: 13, scope: !46)
!79 = !MDLocation(line: 6, column: 23, scope: !46)
!80 = !MDLocation(line: 6, column: 24, scope: !81)
!81 = distinct !MDLexicalBlock(line: 6, column: 23, file: !82, scope: !46)
!82 = !MDFile(filename: "main.cpp", directory: "/Users/echristo/tmp/bad-struct-ref")
!83 = !{i32 1, !"Debug Info Version", i32 3}