1 // RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone -triple aarch64-arm-none-eabi %s -o - | FileCheck %s
8 // CHECK-LABEL: define dso_local void @_Z3fS0v
9 // CHECK: alloca %struct.S0, align 4
10 // CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S0, align 4
11 // CHECK: call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[S0_A:![0-9]+]], metadata !DIExpression())
12 // CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[S0_B:![0-9]+]], metadata !DIExpression(DW_OP_plus_uconst, 2))
20 volatile unsigned int x
: 16;
21 volatile unsigned int y
: 16;
24 // CHECK-LABEL: define dso_local void @_Z3fS1v
25 // CHECK: alloca %struct.S1, align 4
26 // CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S1, align 4
27 // CHECK: call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[S1_A:![0-9]+]], metadata !DIExpression())
28 // CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[S1_B:![0-9]+]], metadata !DIExpression(DW_OP_plus_uconst, 2))
40 // CHECK-LABEL: define dso_local void @_Z3fS2v
41 // CHECK: alloca %struct.S2, align 4
42 // CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S2, align 4
43 // CHECK: call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[S2_A:![0-9]+]], metadata !DIExpression())
44 // CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[S2_B:![0-9]+]], metadata !DIExpression(DW_OP_plus_uconst, 1))
52 volatile unsigned int x
: 8;
53 volatile unsigned int y
: 8;
56 // CHECK-LABEL: define dso_local void @_Z3fS3v
57 // CHECK: alloca %struct.S3, align 4
58 // CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S3, align 4
59 // CHECK: call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[S3_A:![0-9]+]], metadata !DIExpression())
60 // CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[S3_B:![0-9]+]], metadata !DIExpression(DW_OP_plus_uconst, 1))
72 // CHECK-LABEL: define dso_local void @_Z3fS4v
73 // CHECK: alloca %struct.S4, align 4
74 // CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S4, align 4
75 // CHECK: call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[S4_A:![0-9]+]], metadata !DIExpression())
76 // CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[S4_B:![0-9]+]], metadata !DIExpression(DW_OP_plus_uconst, 1))
84 volatile unsigned int x
: 8;
85 volatile unsigned int y
: 16;
88 // CHECK-LABEL: define dso_local void @_Z3fS5v
89 // CHECK: alloca %struct.S5, align 4
90 // CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S5, align 4
91 // CHECK: call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[S5_A:![0-9]+]], metadata !DIExpression())
92 // CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[S5_B:![0-9]+]], metadata !DIExpression(DW_OP_plus_uconst, 1))
104 // CHECK-LABEL: define dso_local void @_Z3fS6v
105 // CHECK: alloca %struct.S6, align 4
106 // CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S6, align 4
107 // CHECK: call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[S6_A:![0-9]+]], metadata !DIExpression())
108 // CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[S6_B:![0-9]+]], metadata !DIExpression(DW_OP_plus_uconst, 2))
116 volatile unsigned int x
: 16;
117 volatile unsigned int y
: 8;
120 // CHECK-LABEL: define dso_local void @_Z3fS7v
121 // CHECK: alloca %struct.S7, align 4
122 // CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S7, align 4
123 // CHECK: call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[S7_A:![0-9]+]], metadata !DIExpression())
124 // CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[S7_B:![0-9]+]], metadata !DIExpression(DW_OP_plus_uconst, 2))
133 volatile unsigned int y
: 16;
136 // CHECK-LABEL: define dso_local void @_Z3fS8v
137 // CHECK: alloca %struct.S8, align 4
138 // CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S8, align 4
139 // CHECK: call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[S8_A:![0-9]+]], metadata !DIExpression())
140 // CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[S8_B:![0-9]+]], metadata !DIExpression(DW_OP_plus_uconst, 2))
152 // CHECK-LABEL: define dso_local void @_Z3fS9v
153 // CHECK: alloca %struct.S9, align 4
154 // CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S9, align 4
155 // CHECK: call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[S9_A:![0-9]+]], metadata !DIExpression())
156 // CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[S9_B:![0-9]+]], metadata !DIExpression(DW_OP_plus_uconst, 4))
164 const unsigned int x
: 8;
165 const volatile unsigned int y
: 8;
167 // CHECK-LABEL: define dso_local void @_Z4fS10v
168 // CHECK: alloca %struct.S10, align 4
169 // CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S10, align 4
170 // CHECK: call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[S10_A:![0-9]+]], metadata !DIExpression())
171 // CHECK-NEXT: call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[S10_B:![0-9]+]], metadata !DIExpression(DW_OP_plus_uconst, 1))
173 S10() : x(0), y(0) {}
181 // It's currently not possible to produce complete debug information for the following cases.
182 // Confirm that no wrong debug info is output.
183 // Once this is implemented, these tests should be amended.
189 // CHECK-LABEL: define dso_local void @_Z4fS11v
190 // CHECK: alloca %struct.S11, align 4
191 // CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S11, align 4
192 // CHECK-NOT: call void @llvm.dbg.declare(metadata ptr [[TMP0]]
204 // CHECK-LABEL: define dso_local void @_Z4fS12v
205 // CHECK: alloca %struct.S12, align 4
206 // CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S12, align 4
207 // CHECK: call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[S12_A:![0-9]+]], metadata !DIExpression())
208 // CHECK-NOT: call void @llvm.dbg.declare(metadata ptr [[TMP0]]
215 struct __attribute__((packed
)) S13
{
220 // CHECK-LABEL: define dso_local void @_Z4fS13v
221 // CHECK: alloca %struct.S13, align 1
222 // CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S13, align 1
223 // CHECK-NOT: call void @llvm.dbg.declare(metadata ptr [[TMP0]]
230 // CHECK: [[UINT_TY:![0-9]+]] = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned)
231 // CHECK: [[S0_A]] = !DILocalVariable(name: "a", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[USHORT_TY:![0-9]+]])
232 // CHECK: [[USHORT_TY]] = !DIBasicType(name: "unsigned short", size: 16, encoding: DW_ATE_unsigned)
233 // CHECK: [[S0_B]] = !DILocalVariable(name: "b", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[USHORT_TY]])
235 // CHECK: [[VOLATILE_UINT_TY:![0-9]+]] = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: [[UINT_TY]])
236 // CHECK: [[S1_A]] = !DILocalVariable(name: "a", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[VOLATILE_USHORT_TY:![0-9]+]])
237 // CHECK: [[VOLATILE_USHORT_TY]] = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: [[USHORT_TY]])
238 // CHECK: [[S1_B]] = !DILocalVariable(name: "b", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[VOLATILE_USHORT_TY]])
240 // CHECK: [[S2_A]] = !DILocalVariable(name: "a", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[UCHAR_TY:![0-9]+]])
241 // CHECK: [[UCHAR_TY]] = !DIBasicType(name: "unsigned char", size: 8, encoding: DW_ATE_unsigned_char)
242 // CHECK: [[S2_B]] = !DILocalVariable(name: "b", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[UCHAR_TY]])
244 // CHECK: [[S3_A]] = !DILocalVariable(name: "a", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[VOLATILE_UCHAR_TY:![0-9]+]])
245 // CHECK: [[VOLATILE_UCHAR_TY]] = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: [[UCHAR_TY]])
246 // CHECK: [[S3_B]] = !DILocalVariable(name: "b", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[VOLATILE_UCHAR_TY]])
248 // CHECK: [[S4_A]] = !DILocalVariable(name: "a", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[UCHAR_TY]])
249 // CHECK: [[S4_B]] = !DILocalVariable(name: "b", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[USHORT_TY]])
251 // CHECK: [[S5_A]] = !DILocalVariable(name: "a", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[VOLATILE_UCHAR_TY]])
252 // CHECK: [[S5_B]] = !DILocalVariable(name: "b", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[VOLATILE_USHORT_TY]])
254 // CHECK: [[S6_A]] = !DILocalVariable(name: "a", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[USHORT_TY]])
255 // CHECK: [[S6_B]] = !DILocalVariable(name: "b", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[UCHAR_TY]])
257 // CHECK: [[S7_A]] = !DILocalVariable(name: "a", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[VOLATILE_USHORT_TY]])
258 // CHECK: [[S7_B]] = !DILocalVariable(name: "b", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[VOLATILE_UCHAR_TY]])
260 // CHECK: [[S8_A]] = !DILocalVariable(name: "a", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[USHORT_TY]])
261 // CHECK: [[S8_B]] = !DILocalVariable(name: "b", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[VOLATILE_USHORT_TY]])
263 // CHECK: [[S9_A]] = !DILocalVariable(name: "a", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[USHORT_TY]])
264 // CHECK: [[S9_B]] = !DILocalVariable(name: "b", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[UINT_TY]])
266 // CHECK: [[CONST_UINT_TY:![0-9]+]] = !DIDerivedType(tag: DW_TAG_const_type, baseType: [[UINT_TY]])
267 // CHECK: [[S10_A]] = !DILocalVariable(name: "a", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[CONST_UCHAR_TY:![0-9]+]])
268 // CHECK: [[CONST_UCHAR_TY]] = !DIDerivedType(tag: DW_TAG_const_type, baseType: [[UCHAR_TY]])
269 // CHECK: [[S10_B]] = !DILocalVariable(name: "b", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[CONST_VOLATILE_UCHAR_TY:![0-9]+]])
270 // CHECK: [[CONST_VOLATILE_UCHAR_TY]] = !DIDerivedType(tag: DW_TAG_const_type, baseType: [[VOLATILE_UCHAR_TY]])
273 // CHECK-NOT: !DILocalVariable(name: "a"
274 // CHECK-NOT: !DILocalVariable(name: "b"
277 // CHECK: [[S12_A]] = !DILocalVariable(name: "a", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[USHORT_TY]])
278 // CHECK-NOT: !DILocalVariable(name: "b"
281 // CHECK-NOT: !DILocalVariable(name: "a"
282 // CHECK-NOT: !DILocalVariable(name: "b"