318 lines · cpp
1// RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone -triple aarch64 %s -o - | FileCheck %s2 3struct S0 {4 unsigned int x : 16;5 unsigned int y : 16;6};7 8// CHECK-LABEL: define dso_local void @_Z3fS0v9// CHECK: alloca %struct.S0, align 410// CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S0, align 411// CHECK: #dbg_declare(ptr [[TMP0]], [[S0_A:![0-9]+]], !DIExpression(DW_OP_LLVM_extract_bits_zext, 0, 16),12// CHECK-NEXT: #dbg_declare(ptr [[TMP0]], [[S0_B:![0-9]+]], !DIExpression(DW_OP_LLVM_extract_bits_zext, 16, 16),13//14void fS0() {15 S0 s0;16 auto [a, b] = s0;17}18 19struct S1 {20 volatile unsigned int x : 16;21 volatile unsigned int y : 16;22};23 24// CHECK-LABEL: define dso_local void @_Z3fS1v25// CHECK: alloca %struct.S1, align 426// CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S1, align 427// CHECK: #dbg_declare(ptr [[TMP0]], [[S1_A:![0-9]+]], !DIExpression(DW_OP_LLVM_extract_bits_zext, 0, 16),28// CHECK-NEXT: #dbg_declare(ptr [[TMP0]], [[S1_B:![0-9]+]], !DIExpression(DW_OP_LLVM_extract_bits_zext, 16, 16),29//30void fS1() {31 S1 s1;32 auto [a, b] = s1;33}34 35struct S2 {36 unsigned int x : 8;37 unsigned int y : 8;38};39 40// CHECK-LABEL: define dso_local void @_Z3fS2v41// CHECK: alloca %struct.S2, align 442// CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S2, align 443// CHECK: #dbg_declare(ptr [[TMP0]], [[S2_A:![0-9]+]], !DIExpression(DW_OP_LLVM_extract_bits_zext, 0, 8),44// CHECK-NEXT: #dbg_declare(ptr [[TMP0]], [[S2_B:![0-9]+]], !DIExpression(DW_OP_LLVM_extract_bits_zext, 8, 8),45//46void fS2() {47 S2 s2;48 auto [a, b] = s2;49}50 51struct S3 {52 volatile unsigned int x : 8;53 volatile unsigned int y : 8;54};55 56// CHECK-LABEL: define dso_local void @_Z3fS3v57// CHECK: alloca %struct.S3, align 458// CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S3, align 459// CHECK: #dbg_declare(ptr [[TMP0]], [[S3_A:![0-9]+]], !DIExpression(DW_OP_LLVM_extract_bits_zext, 0, 8),60// CHECK-NEXT: #dbg_declare(ptr [[TMP0]], [[S3_B:![0-9]+]], !DIExpression(DW_OP_LLVM_extract_bits_zext, 8, 8),61//62void fS3() {63 S3 s3;64 auto [a, b] = s3;65}66 67struct S4 {68 unsigned int x : 8;69 unsigned int y : 16;70};71 72// CHECK-LABEL: define dso_local void @_Z3fS4v73// CHECK: alloca %struct.S4, align 474// CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S4, align 475// CHECK: #dbg_declare(ptr [[TMP0]], [[S4_A:![0-9]+]], !DIExpression(DW_OP_LLVM_extract_bits_zext, 0, 8),76// CHECK-NEXT: #dbg_declare(ptr [[TMP0]], [[S4_B:![0-9]+]], !DIExpression(DW_OP_LLVM_extract_bits_zext, 8, 16),77//78void fS4() {79 S4 s4;80 auto [a, b] = s4;81}82 83struct S5 {84 volatile unsigned int x : 8;85 volatile unsigned int y : 16;86};87 88// CHECK-LABEL: define dso_local void @_Z3fS5v89// CHECK: alloca %struct.S5, align 490// CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S5, align 491// CHECK: #dbg_declare(ptr [[TMP0]], [[S5_A:![0-9]+]], !DIExpression(DW_OP_LLVM_extract_bits_zext, 0, 8),92// CHECK-NEXT: #dbg_declare(ptr [[TMP0]], [[S5_B:![0-9]+]], !DIExpression(DW_OP_LLVM_extract_bits_zext, 8, 16),93//94void fS5() {95 S5 s5;96 auto [a, b] = s5;97}98 99struct S6 {100 unsigned int x : 16;101 unsigned int y : 8;102};103 104// CHECK-LABEL: define dso_local void @_Z3fS6v105// CHECK: alloca %struct.S6, align 4106// CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S6, align 4107// CHECK: #dbg_declare(ptr [[TMP0]], [[S6_A:![0-9]+]], !DIExpression(DW_OP_LLVM_extract_bits_zext, 0, 16),108// CHECK-NEXT: #dbg_declare(ptr [[TMP0]], [[S6_B:![0-9]+]], !DIExpression(DW_OP_LLVM_extract_bits_zext, 16, 8),109//110void fS6() {111 S6 s6;112 auto [a, b] = s6;113}114 115struct S7 {116 volatile unsigned int x : 16;117 volatile unsigned int y : 8;118};119 120// CHECK-LABEL: define dso_local void @_Z3fS7v121// CHECK: alloca %struct.S7, align 4122// CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S7, align 4123// CHECK: #dbg_declare(ptr [[TMP0]], [[S7_A:![0-9]+]], !DIExpression(DW_OP_LLVM_extract_bits_zext, 0, 16),124// CHECK-NEXT: #dbg_declare(ptr [[TMP0]], [[S7_B:![0-9]+]], !DIExpression(DW_OP_LLVM_extract_bits_zext, 16, 8),125//126void fS7() {127 S7 s7;128 auto [a, b] = s7;129}130 131struct S8 {132 unsigned int x : 16;133 volatile unsigned int y : 16;134};135 136// CHECK-LABEL: define dso_local void @_Z3fS8v137// CHECK: alloca %struct.S8, align 4138// CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S8, align 4139// CHECK: #dbg_declare(ptr [[TMP0]], [[S8_A:![0-9]+]], !DIExpression(DW_OP_LLVM_extract_bits_zext, 0, 16),140// CHECK-NEXT: #dbg_declare(ptr [[TMP0]], [[S8_B:![0-9]+]], !DIExpression(DW_OP_LLVM_extract_bits_zext, 16, 16),141//142void fS8() {143 S8 s8;144 auto [a, b] = s8;145}146 147struct S9 {148 unsigned int x : 16;149 unsigned int y : 32;150};151 152// CHECK-LABEL: define dso_local void @_Z3fS9v153// CHECK: alloca %struct.S9, align 4154// CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S9, align 4155// CHECK: #dbg_declare(ptr [[TMP0]], [[S9_A:![0-9]+]], !DIExpression(DW_OP_LLVM_extract_bits_zext, 0, 16),156// CHECK-NEXT: #dbg_declare(ptr [[TMP0]], [[S9_B:![0-9]+]], !DIExpression(DW_OP_LLVM_extract_bits_zext, 32, 32),157//158void fS9() {159 S9 s9;160 auto [a, b] = s9;161}162 163struct S10 {164 const unsigned int x : 8;165 const volatile unsigned int y : 8;166 167// CHECK-LABEL: define dso_local void @_Z4fS10v168// CHECK: alloca %struct.S10, align 4169// CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S10, align 4170// CHECK: #dbg_declare(ptr [[TMP0]], [[S10_A:![0-9]+]], !DIExpression(DW_OP_LLVM_extract_bits_zext, 0, 8),171// CHECK-NEXT: #dbg_declare(ptr [[TMP0]], [[S10_B:![0-9]+]], !DIExpression(DW_OP_LLVM_extract_bits_zext, 8, 8),172//173 S10() : x(0), y(0) {}174};175 176void fS10() {177 S10 s10;178 auto [a, b] = s10;179}180 181struct S11 {182 unsigned int x : 15;183 unsigned int y : 16;184};185 186// CHECK-LABEL: define dso_local void @_Z4fS11v187// CHECK: alloca %struct.S11, align 4188// CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S11, align 4189// CHECK: #dbg_declare(ptr [[TMP0]], [[S11_A:![0-9]+]], !DIExpression(DW_OP_LLVM_extract_bits_zext, 0, 15),190// CHECK-NEXT: #dbg_declare(ptr [[TMP0]], [[S11_B:![0-9]+]], !DIExpression(DW_OP_LLVM_extract_bits_zext, 15, 16),191//192void fS11() {193 S11 s11;194 auto [a, b] = s11;195}196 197struct S12 {198 unsigned int x : 16;199 unsigned int y : 17;200};201 202// CHECK-LABEL: define dso_local void @_Z4fS12v203// CHECK: alloca %struct.S12, align 4204// CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S12, align 4205// CHECK: #dbg_declare(ptr [[TMP0]], [[S12_A:![0-9]+]], !DIExpression(DW_OP_LLVM_extract_bits_zext, 0, 16),206// CHECK-NEXT: #dbg_declare(ptr [[TMP0]], [[S12_B:![0-9]+]], !DIExpression(DW_OP_LLVM_extract_bits_zext, 32, 17),207//208void fS12() {209 S12 s12;210 auto [a, b] = s12;211}212 213struct __attribute__((packed)) S13 {214 unsigned int x : 15;215 unsigned int y : 16;216};217 218// CHECK-LABEL: define dso_local void @_Z4fS13v219// CHECK: alloca %struct.S13, align 1220// CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S13, align 1221// CHECK: #dbg_declare(ptr [[TMP0]], [[S13_A:![0-9]+]], !DIExpression(DW_OP_LLVM_extract_bits_zext, 0, 15),222// CHECK-NEXT: #dbg_declare(ptr [[TMP0]], [[S13_B:![0-9]+]], !DIExpression(DW_OP_LLVM_extract_bits_zext, 15, 16),223//224void fS13() {225 S13 s13;226 auto [a, b] = s13;227}228 229struct S14 {230 signed int x;231 signed int y : 7;232};233 234// CHECK-LABEL: define dso_local void @_Z4fS14v235// CHECK: alloca %struct.S14, align 4236// CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S14, align 4237// CHECK: #dbg_declare(ptr [[TMP0]], [[S14_A:![0-9]+]], !DIExpression(),238// CHECK-NEXT: #dbg_declare(ptr [[TMP0]], [[S14_B:![0-9]+]], !DIExpression(DW_OP_plus_uconst, 4, DW_OP_LLVM_extract_bits_sext, 0, 7),239//240void fS14() {241 S14 s14;242 auto [a, b] = s14;243}244 245struct S15 {246 signed int x : 123;247 unsigned int y : 987;248};249 250// CHECK-LABEL: define dso_local void @_Z4fS15v251// CHECK: alloca %struct.S15, align 16252// CHECK-NEXT: [[TMP0:%.*]] = alloca %struct.S15, align 16253// CHECK: #dbg_declare(ptr [[TMP0]], [[S15_A:![0-9]+]], !DIExpression(DW_OP_LLVM_extract_bits_sext, 0, 32),254// CHECK-NEXT: #dbg_declare(ptr [[TMP0]], [[S15_B:![0-9]+]], !DIExpression(DW_OP_plus_uconst, 16, DW_OP_LLVM_extract_bits_zext, 0, 32),255//256void fS15() {257 S15 s15;258 auto [a, b] = s15;259}260 261// CHECK: [[UINT_TY:![0-9]+]] = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned)262// CHECK: [[S0_A]] = !DILocalVariable(name: "a", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[UINT_TY]])263// CHECK: [[S0_B]] = !DILocalVariable(name: "b", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[UINT_TY]])264 265// CHECK: [[VOLATILE_UINT_TY:![0-9]+]] = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: [[UINT_TY]])266// CHECK: [[S1_A]] = !DILocalVariable(name: "a", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[VOLATILE_UINT_TY:![0-9]+]])267// CHECK: [[S1_B]] = !DILocalVariable(name: "b", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[VOLATILE_UINT_TY]])268 269// CHECK: [[S2_A]] = !DILocalVariable(name: "a", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[UINT_TY]])270// CHECK: [[S2_B]] = !DILocalVariable(name: "b", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[UINT_TY]])271 272// CHECK: [[S3_A]] = !DILocalVariable(name: "a", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[VOLATILE_UINT_TY]])273// CHECK: [[S3_B]] = !DILocalVariable(name: "b", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[VOLATILE_UINT_TY]])274 275// CHECK: [[S4_A]] = !DILocalVariable(name: "a", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[UINT_TY]])276// CHECK: [[S4_B]] = !DILocalVariable(name: "b", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[UINT_TY]])277 278// CHECK: [[S5_A]] = !DILocalVariable(name: "a", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[VOLATILE_UINT_TY]])279// CHECK: [[S5_B]] = !DILocalVariable(name: "b", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[VOLATILE_UINT_TY]])280 281// CHECK: [[S6_A]] = !DILocalVariable(name: "a", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[UINT_TY]])282// CHECK: [[S6_B]] = !DILocalVariable(name: "b", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[UINT_TY]])283 284// CHECK: [[S7_A]] = !DILocalVariable(name: "a", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[VOLATILE_UINT_TY]])285// CHECK: [[S7_B]] = !DILocalVariable(name: "b", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[VOLATILE_UINT_TY]])286 287// CHECK: [[S8_A]] = !DILocalVariable(name: "a", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[UINT_TY]])288// CHECK: [[S8_B]] = !DILocalVariable(name: "b", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[VOLATILE_UINT_TY]])289 290// CHECK: [[S9_A]] = !DILocalVariable(name: "a", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[UINT_TY]])291// CHECK: [[S9_B]] = !DILocalVariable(name: "b", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[UINT_TY]])292 293// CHECK: [[CONST_UINT_TY:![0-9]+]] = !DIDerivedType(tag: DW_TAG_const_type, baseType: [[UINT_TY]])294// CHECK: [[CONST_VOLATILE_UINT_TY:![0-9]+]] = !DIDerivedType(tag: DW_TAG_const_type, baseType: [[VOLATILE_UINT_TY]])295// CHECK: [[S10_A]] = !DILocalVariable(name: "a", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[CONST_UINT_TY]])296// CHECK: [[S10_B]] = !DILocalVariable(name: "b", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[CONST_VOLATILE_UINT_TY]])297 298// S11299// CHECK: [[S11_A]] = !DILocalVariable(name: "a", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[UINT_TY]])300// CHECK: [[S11_B]] = !DILocalVariable(name: "b", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[UINT_TY]])301 302// S12303// CHECK: [[S12_A]] = !DILocalVariable(name: "a", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[UINT_TY]])304// CHECK: [[S12_B]] = !DILocalVariable(name: "b", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[UINT_TY]])305 306// S13307// CHECK: [[S13_A]] = !DILocalVariable(name: "a", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[UINT_TY]])308// CHECK: [[S13_B]] = !DILocalVariable(name: "b", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[UINT_TY]])309 310// S14311// CHECK: [[SINT_TY:![0-9]+]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)312// CHECK: [[S14_A]] = !DILocalVariable(name: "a", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[SINT_TY]])313// CHECK: [[S14_B]] = !DILocalVariable(name: "b", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[SINT_TY]])314 315// S15316// CHECK: [[S15_A]] = !DILocalVariable(name: "a", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[SINT_TY]])317// CHECK: [[S15_B]] = !DILocalVariable(name: "b", scope: {{.*}}, file: {{.*}}, line: {{.*}}, type: [[UINT_TY]])318