vhscampos updated this revision to Diff 549359.
vhscampos added a comment.

- Addressed the one comment regarding code.
- Changed the test to use update_cc_test


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157479/new/

https://reviews.llvm.org/D157479

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/CodeGen/CGDebugInfo.h
  clang/test/CodeGenCXX/debug-info-structured-binding-bitfield.cpp

Index: clang/test/CodeGenCXX/debug-info-structured-binding-bitfield.cpp
===================================================================
--- /dev/null
+++ clang/test/CodeGenCXX/debug-info-structured-binding-bitfield.cpp
@@ -0,0 +1,557 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals --version 2
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone -triple aarch64-arm-none-eabi %s -o - | FileCheck %s
+
+struct S0 {
+  unsigned int x : 16;
+  unsigned int y : 16;
+};
+
+// CHECK-LABEL: define dso_local void @_Z3fS0v
+// CHECK-SAME: () #[[ATTR0:[0-9]+]] !dbg [[DBG5:![0-9]+]] {
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:    [[S0:%.*]] = alloca [[STRUCT_S0:%.*]], align 4
+// CHECK-NEXT:    [[TMP0:%.*]] = alloca [[STRUCT_S0]], align 4
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[S0]], metadata [[META10:![0-9]+]], metadata !DIExpression()), !dbg [[DBG16:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META17:![0-9]+]], metadata !DIExpression()), !dbg [[DBG19:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META20:![0-9]+]], metadata !DIExpression(DW_OP_plus_uconst, 2)), !dbg [[DBG21:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META22:![0-9]+]], metadata !DIExpression()), !dbg [[DBG23:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[TMP0]], ptr align 4 [[S0]], i64 4, i1 false), !dbg [[DBG24:![0-9]+]]
+// CHECK-NEXT:    ret void, !dbg [[DBG25:![0-9]+]]
+//
+void fS0() {
+  S0 s0;
+  auto [a, b] = s0;
+}
+
+struct S1 {
+  volatile unsigned int x : 16;
+  volatile unsigned int y : 16;
+};
+
+// CHECK-LABEL: define dso_local void @_Z3fS1v
+// CHECK-SAME: () #[[ATTR0]] !dbg [[DBG26:![0-9]+]] {
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:    [[S1:%.*]] = alloca [[STRUCT_S1:%.*]], align 4
+// CHECK-NEXT:    [[TMP0:%.*]] = alloca [[STRUCT_S1]], align 4
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[S1]], metadata [[META27:![0-9]+]], metadata !DIExpression()), !dbg [[DBG33:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META34:![0-9]+]], metadata !DIExpression()), !dbg [[DBG36:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META37:![0-9]+]], metadata !DIExpression(DW_OP_plus_uconst, 2)), !dbg [[DBG38:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META39:![0-9]+]], metadata !DIExpression()), !dbg [[DBG40:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[TMP0]], ptr align 4 [[S1]], i64 4, i1 false), !dbg [[DBG41:![0-9]+]]
+// CHECK-NEXT:    ret void, !dbg [[DBG42:![0-9]+]]
+//
+void fS1() {
+  S1 s1;
+  auto [a, b] = s1;
+}
+
+struct S2 {
+  unsigned int x : 8;
+  unsigned int y : 8;
+};
+
+// CHECK-LABEL: define dso_local void @_Z3fS2v
+// CHECK-SAME: () #[[ATTR0]] !dbg [[DBG43:![0-9]+]] {
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:    [[S2:%.*]] = alloca [[STRUCT_S2:%.*]], align 4
+// CHECK-NEXT:    [[TMP0:%.*]] = alloca [[STRUCT_S2]], align 4
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[S2]], metadata [[META44:![0-9]+]], metadata !DIExpression()), !dbg [[DBG49:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META50:![0-9]+]], metadata !DIExpression()), !dbg [[DBG52:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META53:![0-9]+]], metadata !DIExpression(DW_OP_plus_uconst, 1)), !dbg [[DBG54:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META55:![0-9]+]], metadata !DIExpression()), !dbg [[DBG56:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[TMP0]], ptr align 4 [[S2]], i64 4, i1 false), !dbg [[DBG57:![0-9]+]]
+// CHECK-NEXT:    ret void, !dbg [[DBG58:![0-9]+]]
+//
+void fS2() {
+  S2 s2;
+  auto [a, b] = s2;
+}
+
+struct S3 {
+  volatile unsigned int x : 8;
+  volatile unsigned int y : 8;
+};
+
+// CHECK-LABEL: define dso_local void @_Z3fS3v
+// CHECK-SAME: () #[[ATTR0]] !dbg [[DBG59:![0-9]+]] {
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:    [[S3:%.*]] = alloca [[STRUCT_S3:%.*]], align 4
+// CHECK-NEXT:    [[TMP0:%.*]] = alloca [[STRUCT_S3]], align 4
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[S3]], metadata [[META60:![0-9]+]], metadata !DIExpression()), !dbg [[DBG65:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META66:![0-9]+]], metadata !DIExpression()), !dbg [[DBG68:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META69:![0-9]+]], metadata !DIExpression(DW_OP_plus_uconst, 1)), !dbg [[DBG70:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META71:![0-9]+]], metadata !DIExpression()), !dbg [[DBG72:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[TMP0]], ptr align 4 [[S3]], i64 4, i1 false), !dbg [[DBG73:![0-9]+]]
+// CHECK-NEXT:    ret void, !dbg [[DBG74:![0-9]+]]
+//
+void fS3() {
+  S3 s3;
+  auto [a, b] = s3;
+}
+
+struct S4 {
+  unsigned int x : 8;
+  unsigned int y : 16;
+};
+
+// CHECK-LABEL: define dso_local void @_Z3fS4v
+// CHECK-SAME: () #[[ATTR0]] !dbg [[DBG75:![0-9]+]] {
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:    [[S4:%.*]] = alloca [[STRUCT_S4:%.*]], align 4
+// CHECK-NEXT:    [[TMP0:%.*]] = alloca [[STRUCT_S4]], align 4
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[S4]], metadata [[META76:![0-9]+]], metadata !DIExpression()), !dbg [[DBG81:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META82:![0-9]+]], metadata !DIExpression()), !dbg [[DBG83:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META84:![0-9]+]], metadata !DIExpression(DW_OP_plus_uconst, 1)), !dbg [[DBG85:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META86:![0-9]+]], metadata !DIExpression()), !dbg [[DBG87:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[TMP0]], ptr align 4 [[S4]], i64 4, i1 false), !dbg [[DBG88:![0-9]+]]
+// CHECK-NEXT:    ret void, !dbg [[DBG89:![0-9]+]]
+//
+void fS4() {
+  S4 s4;
+  auto [a, b] = s4;
+}
+
+struct S5 {
+  volatile unsigned int x : 8;
+  volatile unsigned int y : 16;
+};
+
+// CHECK-LABEL: define dso_local void @_Z3fS5v
+// CHECK-SAME: () #[[ATTR0]] !dbg [[DBG90:![0-9]+]] {
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:    [[S5:%.*]] = alloca [[STRUCT_S5:%.*]], align 4
+// CHECK-NEXT:    [[TMP0:%.*]] = alloca [[STRUCT_S5]], align 4
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[S5]], metadata [[META91:![0-9]+]], metadata !DIExpression()), !dbg [[DBG96:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META97:![0-9]+]], metadata !DIExpression()), !dbg [[DBG98:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META99:![0-9]+]], metadata !DIExpression(DW_OP_plus_uconst, 1)), !dbg [[DBG100:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META101:![0-9]+]], metadata !DIExpression()), !dbg [[DBG102:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[TMP0]], ptr align 4 [[S5]], i64 4, i1 false), !dbg [[DBG103:![0-9]+]]
+// CHECK-NEXT:    ret void, !dbg [[DBG104:![0-9]+]]
+//
+void fS5() {
+  S5 s5;
+  auto [a, b] = s5;
+}
+
+struct S6 {
+  unsigned int x : 16;
+  unsigned int y : 8;
+};
+
+// CHECK-LABEL: define dso_local void @_Z3fS6v
+// CHECK-SAME: () #[[ATTR0]] !dbg [[DBG105:![0-9]+]] {
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:    [[S6:%.*]] = alloca [[STRUCT_S6:%.*]], align 4
+// CHECK-NEXT:    [[TMP0:%.*]] = alloca [[STRUCT_S6]], align 4
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[S6]], metadata [[META106:![0-9]+]], metadata !DIExpression()), !dbg [[DBG111:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META112:![0-9]+]], metadata !DIExpression()), !dbg [[DBG113:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META114:![0-9]+]], metadata !DIExpression(DW_OP_plus_uconst, 2)), !dbg [[DBG115:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META116:![0-9]+]], metadata !DIExpression()), !dbg [[DBG117:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[TMP0]], ptr align 4 [[S6]], i64 4, i1 false), !dbg [[DBG118:![0-9]+]]
+// CHECK-NEXT:    ret void, !dbg [[DBG119:![0-9]+]]
+//
+void fS6() {
+  S6 s6;
+  auto [a, b] = s6;
+}
+
+struct S7 {
+  volatile unsigned int x : 16;
+  volatile unsigned int y : 8;
+};
+
+// CHECK-LABEL: define dso_local void @_Z3fS7v
+// CHECK-SAME: () #[[ATTR0]] !dbg [[DBG120:![0-9]+]] {
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:    [[S7:%.*]] = alloca [[STRUCT_S7:%.*]], align 4
+// CHECK-NEXT:    [[TMP0:%.*]] = alloca [[STRUCT_S7]], align 4
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[S7]], metadata [[META121:![0-9]+]], metadata !DIExpression()), !dbg [[DBG126:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META127:![0-9]+]], metadata !DIExpression()), !dbg [[DBG128:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META129:![0-9]+]], metadata !DIExpression(DW_OP_plus_uconst, 2)), !dbg [[DBG130:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META131:![0-9]+]], metadata !DIExpression()), !dbg [[DBG132:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[TMP0]], ptr align 4 [[S7]], i64 4, i1 false), !dbg [[DBG133:![0-9]+]]
+// CHECK-NEXT:    ret void, !dbg [[DBG134:![0-9]+]]
+//
+void fS7() {
+  S7 s7;
+  auto [a, b] = s7;
+}
+
+struct S8 {
+  unsigned int x : 16;
+  volatile unsigned int y : 16;
+};
+
+// CHECK-LABEL: define dso_local void @_Z3fS8v
+// CHECK-SAME: () #[[ATTR0]] !dbg [[DBG135:![0-9]+]] {
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:    [[S8:%.*]] = alloca [[STRUCT_S8:%.*]], align 4
+// CHECK-NEXT:    [[TMP0:%.*]] = alloca [[STRUCT_S8]], align 4
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[S8]], metadata [[META136:![0-9]+]], metadata !DIExpression()), !dbg [[DBG141:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META142:![0-9]+]], metadata !DIExpression()), !dbg [[DBG143:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META144:![0-9]+]], metadata !DIExpression(DW_OP_plus_uconst, 2)), !dbg [[DBG145:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META146:![0-9]+]], metadata !DIExpression()), !dbg [[DBG147:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[TMP0]], ptr align 4 [[S8]], i64 4, i1 false), !dbg [[DBG148:![0-9]+]]
+// CHECK-NEXT:    ret void, !dbg [[DBG149:![0-9]+]]
+//
+void fS8() {
+  S8 s8;
+  auto [a, b] = s8;
+}
+
+struct S9 {
+  unsigned int x : 16;
+  unsigned int y : 32;
+};
+
+// CHECK-LABEL: define dso_local void @_Z3fS9v
+// CHECK-SAME: () #[[ATTR0]] !dbg [[DBG150:![0-9]+]] {
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:    [[S9:%.*]] = alloca [[STRUCT_S9:%.*]], align 4
+// CHECK-NEXT:    [[TMP0:%.*]] = alloca [[STRUCT_S9]], align 4
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[S9]], metadata [[META151:![0-9]+]], metadata !DIExpression()), !dbg [[DBG156:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META157:![0-9]+]], metadata !DIExpression()), !dbg [[DBG158:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META159:![0-9]+]], metadata !DIExpression(DW_OP_plus_uconst, 4)), !dbg [[DBG160:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META161:![0-9]+]], metadata !DIExpression()), !dbg [[DBG162:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[TMP0]], ptr align 4 [[S9]], i64 8, i1 false), !dbg [[DBG163:![0-9]+]]
+// CHECK-NEXT:    ret void, !dbg [[DBG164:![0-9]+]]
+//
+void fS9() {
+  S9 s9;
+  auto [a, b] = s9;
+}
+
+struct S10 {
+  const unsigned int x : 8;
+  const volatile unsigned int y : 8;
+
+// CHECK-LABEL: define dso_local void @_Z4fS10v
+// CHECK-SAME: () #[[ATTR0]] !dbg [[DBG165:![0-9]+]] {
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:    [[S10:%.*]] = alloca [[STRUCT_S10:%.*]], align 4
+// CHECK-NEXT:    [[TMP0:%.*]] = alloca [[STRUCT_S10]], align 4
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[S10]], metadata [[META166:![0-9]+]], metadata !DIExpression()), !dbg [[DBG177:![0-9]+]]
+// CHECK-NEXT:    call void @_ZN3S10C1Ev(ptr noundef nonnull align 4 dereferenceable(2) [[S10]]), !dbg [[DBG177]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META178:![0-9]+]], metadata !DIExpression()), !dbg [[DBG180:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META181:![0-9]+]], metadata !DIExpression(DW_OP_plus_uconst, 1)), !dbg [[DBG183:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META184:![0-9]+]], metadata !DIExpression()), !dbg [[DBG185:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[TMP0]], ptr align 4 [[S10]], i64 4, i1 false), !dbg [[DBG186:![0-9]+]]
+// CHECK-NEXT:    ret void, !dbg [[DBG187:![0-9]+]]
+//
+  S10() : x(0), y(0) {}
+};
+
+// CHECK-LABEL: define linkonce_odr void @_ZN3S10C1Ev
+// CHECK-SAME: (ptr noundef nonnull align 4 dereferenceable(2) [[THIS:%.*]]) unnamed_addr #[[ATTR3:[0-9]+]] comdat align 2 !dbg [[DBG188:![0-9]+]] {
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:    [[THIS_ADDR:%.*]] = alloca ptr, align 8
+// CHECK-NEXT:    store ptr [[THIS]], ptr [[THIS_ADDR]], align 8
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[THIS_ADDR]], metadata [[META189:![0-9]+]], metadata !DIExpression()), !dbg [[DBG191:![0-9]+]]
+// CHECK-NEXT:    [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]], align 8
+// CHECK-NEXT:    call void @_ZN3S10C2Ev(ptr noundef nonnull align 4 dereferenceable(2) [[THIS1]]), !dbg [[DBG192:![0-9]+]]
+// CHECK-NEXT:    ret void, !dbg [[DBG193:![0-9]+]]
+//
+void fS10() {
+  S10 s10;
+  auto [a, b] = s10;
+}
+
+// It's currently not possible to produce complete debug information for the following cases.
+// Confirm that no wrong debug info is output.
+// Once this is implemented, these tests should be amended.
+struct S11 {
+  unsigned int x : 15;
+  unsigned int y : 16;
+};
+
+// CHECK-LABEL: define dso_local void @_Z4fS11v
+// CHECK-SAME: () #[[ATTR0]] !dbg [[DBG194:![0-9]+]] {
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:    [[S11:%.*]] = alloca [[STRUCT_S11:%.*]], align 4
+// CHECK-NEXT:    [[TMP0:%.*]] = alloca [[STRUCT_S11]], align 4
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[S11]], metadata [[META195:![0-9]+]], metadata !DIExpression()), !dbg [[DBG200:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META201:![0-9]+]], metadata !DIExpression()), !dbg [[DBG202:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[TMP0]], ptr align 4 [[S11]], i64 4, i1 false), !dbg [[DBG203:![0-9]+]]
+// CHECK-NEXT:    ret void, !dbg [[DBG204:![0-9]+]]
+//
+void fS11() {
+  S11 s11;
+  auto [a, b] = s11;
+}
+
+struct S12 {
+  unsigned int x : 16;
+  unsigned int y : 17;
+};
+
+// CHECK-LABEL: define dso_local void @_Z4fS12v
+// CHECK-SAME: () #[[ATTR0]] !dbg [[DBG205:![0-9]+]] {
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:    [[S12:%.*]] = alloca [[STRUCT_S12:%.*]], align 4
+// CHECK-NEXT:    [[TMP0:%.*]] = alloca [[STRUCT_S12]], align 4
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[S12]], metadata [[META206:![0-9]+]], metadata !DIExpression()), !dbg [[DBG211:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META212:![0-9]+]], metadata !DIExpression()), !dbg [[DBG213:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META214:![0-9]+]], metadata !DIExpression()), !dbg [[DBG215:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[TMP0]], ptr align 4 [[S12]], i64 8, i1 false), !dbg [[DBG216:![0-9]+]]
+// CHECK-NEXT:    ret void, !dbg [[DBG217:![0-9]+]]
+//
+void fS12() {
+  S12 s12;
+  auto [a, b] = s12;
+}
+
+struct __attribute__((packed)) S13 {
+  unsigned int x : 15;
+  unsigned int y : 16;
+};
+
+// CHECK-LABEL: define dso_local void @_Z4fS13v
+// CHECK-SAME: () #[[ATTR0]] !dbg [[DBG218:![0-9]+]] {
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:    [[S13:%.*]] = alloca [[STRUCT_S13:%.*]], align 1
+// CHECK-NEXT:    [[TMP0:%.*]] = alloca [[STRUCT_S13]], align 1
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[S13]], metadata [[META219:![0-9]+]], metadata !DIExpression()), !dbg [[DBG224:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.dbg.declare(metadata ptr [[TMP0]], metadata [[META225:![0-9]+]], metadata !DIExpression()), !dbg [[DBG226:![0-9]+]]
+// CHECK-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr align 1 [[TMP0]], ptr align 1 [[S13]], i64 4, i1 false), !dbg [[DBG227:![0-9]+]]
+// CHECK-NEXT:    ret void, !dbg [[DBG228:![0-9]+]]
+//
+void fS13() {
+  S13 s13;
+  auto [a, b] = s13;
+}
+//.
+// CHECK: attributes #0 = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
+// CHECK: attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
+// CHECK: attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
+// CHECK: attributes #3 = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
+//.
+// CHECK: !5 = distinct !DISubprogram(name: "fS0", linkageName: "_Z3fS0v", scope: !6, file: !6, line: 21, type: !7, scopeLine: 21, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9)
+// CHECK: !7 = !DISubroutineType(types: !8)
+// CHECK: !8 = !{null}
+// CHECK: !9 = !{}
+// CHECK: !10 = !DILocalVariable(name: "s0", scope: !5, file: !6, line: 22, type: !11)
+// CHECK: !11 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S0", file: !6, line: 4, size: 32, flags: DIFlagTypePassByValue, elements: !12, identifier: "_ZTS2S0")
+// CHECK: !12 = !{!13, !15}
+// CHECK: !13 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !11, file: !6, line: 5, baseType: !14, size: 16, flags: DIFlagBitField, extraData: i64 0)
+// CHECK: !14 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned)
+// CHECK: !15 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !11, file: !6, line: 6, baseType: !14, size: 16, offset: 16, flags: DIFlagBitField, extraData: i64 0)
+// CHECK: !16 = !DILocation(line: 22, column: 6, scope: !5)
+// CHECK: !17 = !DILocalVariable(name: "a", scope: !5, file: !6, line: 23, type: !18)
+// CHECK: !18 = !DIBasicType(name: "unsigned short", size: 16, encoding: DW_ATE_unsigned)
+// CHECK: !19 = !DILocation(line: 23, column: 9, scope: !5)
+// CHECK: !20 = !DILocalVariable(name: "b", scope: !5, file: !6, line: 23, type: !18)
+// CHECK: !21 = !DILocation(line: 23, column: 12, scope: !5)
+// CHECK: !22 = !DILocalVariable(scope: !5, file: !6, line: 23, type: !11)
+// CHECK: !23 = !DILocation(line: 23, column: 8, scope: !5)
+// CHECK: !24 = !DILocation(line: 23, column: 17, scope: !5)
+// CHECK: !25 = !DILocation(line: 24, column: 1, scope: !5)
+// CHECK: !26 = distinct !DISubprogram(name: "fS1", linkageName: "_Z3fS1v", scope: !6, file: !6, line: 43, type: !7, scopeLine: 43, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9)
+// CHECK: !27 = !DILocalVariable(name: "s1", scope: !26, file: !6, line: 44, type: !28)
+// CHECK: !28 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S1", file: !6, line: 26, size: 32, flags: DIFlagTypePassByValue, elements: !29, identifier: "_ZTS2S1")
+// CHECK: !29 = !{!30, !32}
+// CHECK: !30 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !28, file: !6, line: 27, baseType: !31, size: 16, flags: DIFlagBitField, extraData: i64 0)
+// CHECK: !31 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !14)
+// CHECK: !32 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !28, file: !6, line: 28, baseType: !31, size: 16, offset: 16, flags: DIFlagBitField, extraData: i64 0)
+// CHECK: !33 = !DILocation(line: 44, column: 6, scope: !26)
+// CHECK: !34 = !DILocalVariable(name: "a", scope: !26, file: !6, line: 45, type: !35)
+// CHECK: !35 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !18)
+// CHECK: !36 = !DILocation(line: 45, column: 9, scope: !26)
+// CHECK: !37 = !DILocalVariable(name: "b", scope: !26, file: !6, line: 45, type: !35)
+// CHECK: !38 = !DILocation(line: 45, column: 12, scope: !26)
+// CHECK: !39 = !DILocalVariable(scope: !26, file: !6, line: 45, type: !28)
+// CHECK: !40 = !DILocation(line: 45, column: 8, scope: !26)
+// CHECK: !41 = !DILocation(line: 45, column: 17, scope: !26)
+// CHECK: !42 = !DILocation(line: 46, column: 1, scope: !26)
+// CHECK: !43 = distinct !DISubprogram(name: "fS2", linkageName: "_Z3fS2v", scope: !6, file: !6, line: 65, type: !7, scopeLine: 65, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9)
+// CHECK: !44 = !DILocalVariable(name: "s2", scope: !43, file: !6, line: 66, type: !45)
+// CHECK: !45 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S2", file: !6, line: 48, size: 32, flags: DIFlagTypePassByValue, elements: !46, identifier: "_ZTS2S2")
+// CHECK: !46 = !{!47, !48}
+// CHECK: !47 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !45, file: !6, line: 49, baseType: !14, size: 8, flags: DIFlagBitField, extraData: i64 0)
+// CHECK: !48 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !45, file: !6, line: 50, baseType: !14, size: 8, offset: 8, flags: DIFlagBitField, extraData: i64 0)
+// CHECK: !49 = !DILocation(line: 66, column: 6, scope: !43)
+// CHECK: !50 = !DILocalVariable(name: "a", scope: !43, file: !6, line: 67, type: !51)
+// CHECK: !51 = !DIBasicType(name: "unsigned char", size: 8, encoding: DW_ATE_unsigned_char)
+// CHECK: !52 = !DILocation(line: 67, column: 9, scope: !43)
+// CHECK: !53 = !DILocalVariable(name: "b", scope: !43, file: !6, line: 67, type: !51)
+// CHECK: !54 = !DILocation(line: 67, column: 12, scope: !43)
+// CHECK: !55 = !DILocalVariable(scope: !43, file: !6, line: 67, type: !45)
+// CHECK: !56 = !DILocation(line: 67, column: 8, scope: !43)
+// CHECK: !57 = !DILocation(line: 67, column: 17, scope: !43)
+// CHECK: !58 = !DILocation(line: 68, column: 1, scope: !43)
+// CHECK: !59 = distinct !DISubprogram(name: "fS3", linkageName: "_Z3fS3v", scope: !6, file: !6, line: 87, type: !7, scopeLine: 87, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9)
+// CHECK: !60 = !DILocalVariable(name: "s3", scope: !59, file: !6, line: 88, type: !61)
+// CHECK: !61 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S3", file: !6, line: 70, size: 32, flags: DIFlagTypePassByValue, elements: !62, identifier: "_ZTS2S3")
+// CHECK: !62 = !{!63, !64}
+// CHECK: !63 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !61, file: !6, line: 71, baseType: !31, size: 8, flags: DIFlagBitField, extraData: i64 0)
+// CHECK: !64 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !61, file: !6, line: 72, baseType: !31, size: 8, offset: 8, flags: DIFlagBitField, extraData: i64 0)
+// CHECK: !65 = !DILocation(line: 88, column: 6, scope: !59)
+// CHECK: !66 = !DILocalVariable(name: "a", scope: !59, file: !6, line: 89, type: !67)
+// CHECK: !67 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !51)
+// CHECK: !68 = !DILocation(line: 89, column: 9, scope: !59)
+// CHECK: !69 = !DILocalVariable(name: "b", scope: !59, file: !6, line: 89, type: !67)
+// CHECK: !70 = !DILocation(line: 89, column: 12, scope: !59)
+// CHECK: !71 = !DILocalVariable(scope: !59, file: !6, line: 89, type: !61)
+// CHECK: !72 = !DILocation(line: 89, column: 8, scope: !59)
+// CHECK: !73 = !DILocation(line: 89, column: 17, scope: !59)
+// CHECK: !74 = !DILocation(line: 90, column: 1, scope: !59)
+// CHECK: !75 = distinct !DISubprogram(name: "fS4", linkageName: "_Z3fS4v", scope: !6, file: !6, line: 109, type: !7, scopeLine: 109, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9)
+// CHECK: !76 = !DILocalVariable(name: "s4", scope: !75, file: !6, line: 110, type: !77)
+// CHECK: !77 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S4", file: !6, line: 92, size: 32, flags: DIFlagTypePassByValue, elements: !78, identifier: "_ZTS2S4")
+// CHECK: !78 = !{!79, !80}
+// CHECK: !79 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !77, file: !6, line: 93, baseType: !14, size: 8, flags: DIFlagBitField, extraData: i64 0)
+// CHECK: !80 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !77, file: !6, line: 94, baseType: !14, size: 16, offset: 8, flags: DIFlagBitField, extraData: i64 0)
+// CHECK: !81 = !DILocation(line: 110, column: 6, scope: !75)
+// CHECK: !82 = !DILocalVariable(name: "a", scope: !75, file: !6, line: 111, type: !51)
+// CHECK: !83 = !DILocation(line: 111, column: 9, scope: !75)
+// CHECK: !84 = !DILocalVariable(name: "b", scope: !75, file: !6, line: 111, type: !18)
+// CHECK: !85 = !DILocation(line: 111, column: 12, scope: !75)
+// CHECK: !86 = !DILocalVariable(scope: !75, file: !6, line: 111, type: !77)
+// CHECK: !87 = !DILocation(line: 111, column: 8, scope: !75)
+// CHECK: !88 = !DILocation(line: 111, column: 17, scope: !75)
+// CHECK: !89 = !DILocation(line: 112, column: 1, scope: !75)
+// CHECK: !90 = distinct !DISubprogram(name: "fS5", linkageName: "_Z3fS5v", scope: !6, file: !6, line: 131, type: !7, scopeLine: 131, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9)
+// CHECK: !91 = !DILocalVariable(name: "s5", scope: !90, file: !6, line: 132, type: !92)
+// CHECK: !92 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S5", file: !6, line: 114, size: 32, flags: DIFlagTypePassByValue, elements: !93, identifier: "_ZTS2S5")
+// CHECK: !93 = !{!94, !95}
+// CHECK: !94 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !92, file: !6, line: 115, baseType: !31, size: 8, flags: DIFlagBitField, extraData: i64 0)
+// CHECK: !95 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !92, file: !6, line: 116, baseType: !31, size: 16, offset: 8, flags: DIFlagBitField, extraData: i64 0)
+// CHECK: !96 = !DILocation(line: 132, column: 6, scope: !90)
+// CHECK: !97 = !DILocalVariable(name: "a", scope: !90, file: !6, line: 133, type: !67)
+// CHECK: !98 = !DILocation(line: 133, column: 9, scope: !90)
+// CHECK: !99 = !DILocalVariable(name: "b", scope: !90, file: !6, line: 133, type: !35)
+// CHECK: !100 = !DILocation(line: 133, column: 12, scope: !90)
+// CHECK: !101 = !DILocalVariable(scope: !90, file: !6, line: 133, type: !92)
+// CHECK: !102 = !DILocation(line: 133, column: 8, scope: !90)
+// CHECK: !103 = !DILocation(line: 133, column: 17, scope: !90)
+// CHECK: !104 = !DILocation(line: 134, column: 1, scope: !90)
+// CHECK: !105 = distinct !DISubprogram(name: "fS6", linkageName: "_Z3fS6v", scope: !6, file: !6, line: 153, type: !7, scopeLine: 153, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9)
+// CHECK: !106 = !DILocalVariable(name: "s6", scope: !105, file: !6, line: 154, type: !107)
+// CHECK: !107 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S6", file: !6, line: 136, size: 32, flags: DIFlagTypePassByValue, elements: !108, identifier: "_ZTS2S6")
+// CHECK: !108 = !{!109, !110}
+// CHECK: !109 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !107, file: !6, line: 137, baseType: !14, size: 16, flags: DIFlagBitField, extraData: i64 0)
+// CHECK: !110 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !107, file: !6, line: 138, baseType: !14, size: 8, offset: 16, flags: DIFlagBitField, extraData: i64 0)
+// CHECK: !111 = !DILocation(line: 154, column: 6, scope: !105)
+// CHECK: !112 = !DILocalVariable(name: "a", scope: !105, file: !6, line: 155, type: !18)
+// CHECK: !113 = !DILocation(line: 155, column: 9, scope: !105)
+// CHECK: !114 = !DILocalVariable(name: "b", scope: !105, file: !6, line: 155, type: !51)
+// CHECK: !115 = !DILocation(line: 155, column: 12, scope: !105)
+// CHECK: !116 = !DILocalVariable(scope: !105, file: !6, line: 155, type: !107)
+// CHECK: !117 = !DILocation(line: 155, column: 8, scope: !105)
+// CHECK: !118 = !DILocation(line: 155, column: 17, scope: !105)
+// CHECK: !119 = !DILocation(line: 156, column: 1, scope: !105)
+// CHECK: !120 = distinct !DISubprogram(name: "fS7", linkageName: "_Z3fS7v", scope: !6, file: !6, line: 175, type: !7, scopeLine: 175, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9)
+// CHECK: !121 = !DILocalVariable(name: "s7", scope: !120, file: !6, line: 176, type: !122)
+// CHECK: !122 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S7", file: !6, line: 158, size: 32, flags: DIFlagTypePassByValue, elements: !123, identifier: "_ZTS2S7")
+// CHECK: !123 = !{!124, !125}
+// CHECK: !124 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !122, file: !6, line: 159, baseType: !31, size: 16, flags: DIFlagBitField, extraData: i64 0)
+// CHECK: !125 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !122, file: !6, line: 160, baseType: !31, size: 8, offset: 16, flags: DIFlagBitField, extraData: i64 0)
+// CHECK: !126 = !DILocation(line: 176, column: 6, scope: !120)
+// CHECK: !127 = !DILocalVariable(name: "a", scope: !120, file: !6, line: 177, type: !35)
+// CHECK: !128 = !DILocation(line: 177, column: 9, scope: !120)
+// CHECK: !129 = !DILocalVariable(name: "b", scope: !120, file: !6, line: 177, type: !67)
+// CHECK: !130 = !DILocation(line: 177, column: 12, scope: !120)
+// CHECK: !131 = !DILocalVariable(scope: !120, file: !6, line: 177, type: !122)
+// CHECK: !132 = !DILocation(line: 177, column: 8, scope: !120)
+// CHECK: !133 = !DILocation(line: 177, column: 17, scope: !120)
+// CHECK: !134 = !DILocation(line: 178, column: 1, scope: !120)
+// CHECK: !135 = distinct !DISubprogram(name: "fS8", linkageName: "_Z3fS8v", scope: !6, file: !6, line: 197, type: !7, scopeLine: 197, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9)
+// CHECK: !136 = !DILocalVariable(name: "s8", scope: !135, file: !6, line: 198, type: !137)
+// CHECK: !137 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S8", file: !6, line: 180, size: 32, flags: DIFlagTypePassByValue, elements: !138, identifier: "_ZTS2S8")
+// CHECK: !138 = !{!139, !140}
+// CHECK: !139 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !137, file: !6, line: 181, baseType: !14, size: 16, flags: DIFlagBitField, extraData: i64 0)
+// CHECK: !140 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !137, file: !6, line: 182, baseType: !31, size: 16, offset: 16, flags: DIFlagBitField, extraData: i64 0)
+// CHECK: !141 = !DILocation(line: 198, column: 6, scope: !135)
+// CHECK: !142 = !DILocalVariable(name: "a", scope: !135, file: !6, line: 199, type: !18)
+// CHECK: !143 = !DILocation(line: 199, column: 9, scope: !135)
+// CHECK: !144 = !DILocalVariable(name: "b", scope: !135, file: !6, line: 199, type: !35)
+// CHECK: !145 = !DILocation(line: 199, column: 12, scope: !135)
+// CHECK: !146 = !DILocalVariable(scope: !135, file: !6, line: 199, type: !137)
+// CHECK: !147 = !DILocation(line: 199, column: 8, scope: !135)
+// CHECK: !148 = !DILocation(line: 199, column: 17, scope: !135)
+// CHECK: !149 = !DILocation(line: 200, column: 1, scope: !135)
+// CHECK: !150 = distinct !DISubprogram(name: "fS9", linkageName: "_Z3fS9v", scope: !6, file: !6, line: 219, type: !7, scopeLine: 219, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9)
+// CHECK: !151 = !DILocalVariable(name: "s9", scope: !150, file: !6, line: 220, type: !152)
+// CHECK: !152 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S9", file: !6, line: 202, size: 64, flags: DIFlagTypePassByValue, elements: !153, identifier: "_ZTS2S9")
+// CHECK: !153 = !{!154, !155}
+// CHECK: !154 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !152, file: !6, line: 203, baseType: !14, size: 16, flags: DIFlagBitField, extraData: i64 0)
+// CHECK: !155 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !152, file: !6, line: 204, baseType: !14, size: 32, offset: 32, flags: DIFlagBitField, extraData: i64 32)
+// CHECK: !156 = !DILocation(line: 220, column: 6, scope: !150)
+// CHECK: !157 = !DILocalVariable(name: "a", scope: !150, file: !6, line: 221, type: !18)
+// CHECK: !158 = !DILocation(line: 221, column: 9, scope: !150)
+// CHECK: !159 = !DILocalVariable(name: "b", scope: !150, file: !6, line: 221, type: !14)
+// CHECK: !160 = !DILocation(line: 221, column: 12, scope: !150)
+// CHECK: !161 = !DILocalVariable(scope: !150, file: !6, line: 221, type: !152)
+// CHECK: !162 = !DILocation(line: 221, column: 8, scope: !150)
+// CHECK: !163 = !DILocation(line: 221, column: 17, scope: !150)
+// CHECK: !164 = !DILocation(line: 222, column: 1, scope: !150)
+// CHECK: !165 = distinct !DISubprogram(name: "fS10", linkageName: "_Z4fS10v", scope: !6, file: !6, line: 254, type: !7, scopeLine: 254, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9)
+// CHECK: !166 = !DILocalVariable(name: "s10", scope: !165, file: !6, line: 255, type: !167)
+// CHECK: !167 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S10", file: !6, line: 224, size: 32, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !168, identifier: "_ZTS3S10")
+// CHECK: !168 = !{!169, !171, !173}
+// CHECK: !169 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !167, file: !6, line: 225, baseType: !170, size: 8, flags: DIFlagBitField, extraData: i64 0)
+// CHECK: !170 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !14)
+// CHECK: !171 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !167, file: !6, line: 226, baseType: !172, size: 8, offset: 8, flags: DIFlagBitField, extraData: i64 0)
+// CHECK: !172 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !31)
+// CHECK: !173 = !DISubprogram(name: "S10", scope: !167, file: !6, line: 241, type: !174, scopeLine: 241, flags: DIFlagPrototyped, spFlags: 0)
+// CHECK: !174 = !DISubroutineType(types: !175)
+// CHECK: !175 = !{null, !176}
+// CHECK: !176 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !167, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
+// CHECK: !177 = !DILocation(line: 255, column: 7, scope: !165)
+// CHECK: !178 = !DILocalVariable(name: "a", scope: !165, file: !6, line: 256, type: !179)
+// CHECK: !179 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !51)
+// CHECK: !180 = !DILocation(line: 256, column: 9, scope: !165)
+// CHECK: !181 = !DILocalVariable(name: "b", scope: !165, file: !6, line: 256, type: !182)
+// CHECK: !182 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !67)
+// CHECK: !183 = !DILocation(line: 256, column: 12, scope: !165)
+// CHECK: !184 = !DILocalVariable(scope: !165, file: !6, line: 256, type: !167)
+// CHECK: !185 = !DILocation(line: 256, column: 8, scope: !165)
+// CHECK: !186 = !DILocation(line: 256, column: 17, scope: !165)
+// CHECK: !187 = !DILocation(line: 257, column: 1, scope: !165)
+// CHECK: !188 = distinct !DISubprogram(name: "S10", linkageName: "_ZN3S10C1Ev", scope: !167, file: !6, line: 241, type: !174, scopeLine: 241, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, declaration: !173, retainedNodes: !9)
+// CHECK: !189 = !DILocalVariable(name: "this", arg: 1, scope: !188, type: !190, flags: DIFlagArtificial | DIFlagObjectPointer)
+// CHECK: !190 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !167, size: 64)
+// CHECK: !191 = !DILocation(line: 0, scope: !188)
+// CHECK: !192 = !DILocation(line: 241, column: 22, scope: !188)
+// CHECK: !193 = !DILocation(line: 241, column: 23, scope: !188)
+// CHECK: !194 = distinct !DISubprogram(name: "fS11", linkageName: "_Z4fS11v", scope: !6, file: !6, line: 277, type: !7, scopeLine: 277, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9)
+// CHECK: !195 = !DILocalVariable(name: "s11", scope: !194, file: !6, line: 278, type: !196)
+// CHECK: !196 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S11", file: !6, line: 262, size: 32, flags: DIFlagTypePassByValue, elements: !197, identifier: "_ZTS3S11")
+// CHECK: !197 = !{!198, !199}
+// CHECK: !198 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !196, file: !6, line: 263, baseType: !14, size: 15, flags: DIFlagBitField, extraData: i64 0)
+// CHECK: !199 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !196, file: !6, line: 264, baseType: !14, size: 16, offset: 15, flags: DIFlagBitField, extraData: i64 0)
+// CHECK: !200 = !DILocation(line: 278, column: 7, scope: !194)
+// CHECK: !201 = !DILocalVariable(scope: !194, file: !6, line: 279, type: !196)
+// CHECK: !202 = !DILocation(line: 279, column: 8, scope: !194)
+// CHECK: !203 = !DILocation(line: 279, column: 17, scope: !194)
+// CHECK: !204 = !DILocation(line: 280, column: 1, scope: !194)
+// CHECK: !205 = distinct !DISubprogram(name: "fS12", linkageName: "_Z4fS12v", scope: !6, file: !6, line: 298, type: !7, scopeLine: 298, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9)
+// CHECK: !206 = !DILocalVariable(name: "s12", scope: !205, file: !6, line: 299, type: !207)
+// CHECK: !207 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S12", file: !6, line: 282, size: 64, flags: DIFlagTypePassByValue, elements: !208, identifier: "_ZTS3S12")
+// CHECK: !208 = !{!209, !210}
+// CHECK: !209 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !207, file: !6, line: 283, baseType: !14, size: 16, flags: DIFlagBitField, extraData: i64 0)
+// CHECK: !210 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !207, file: !6, line: 284, baseType: !14, size: 17, offset: 32, flags: DIFlagBitField, extraData: i64 32)
+// CHECK: !211 = !DILocation(line: 299, column: 7, scope: !205)
+// CHECK: !212 = !DILocalVariable(name: "a", scope: !205, file: !6, line: 300, type: !18)
+// CHECK: !213 = !DILocation(line: 300, column: 9, scope: !205)
+// CHECK: !214 = !DILocalVariable(scope: !205, file: !6, line: 300, type: !207)
+// CHECK: !215 = !DILocation(line: 300, column: 8, scope: !205)
+// CHECK: !216 = !DILocation(line: 300, column: 17, scope: !205)
+// CHECK: !217 = !DILocation(line: 301, column: 1, scope: !205)
+// CHECK: !218 = distinct !DISubprogram(name: "fS13", linkageName: "_Z4fS13v", scope: !6, file: !6, line: 318, type: !7, scopeLine: 318, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9)
+// CHECK: !219 = !DILocalVariable(name: "s13", scope: !218, file: !6, line: 319, type: !220)
+// CHECK: !220 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S13", file: !6, line: 303, size: 32, flags: DIFlagTypePassByValue, elements: !221, identifier: "_ZTS3S13")
+// CHECK: !221 = !{!222, !223}
+// CHECK: !222 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !220, file: !6, line: 304, baseType: !14, size: 15, flags: DIFlagBitField, extraData: i64 0)
+// CHECK: !223 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !220, file: !6, line: 305, baseType: !14, size: 16, offset: 15, flags: DIFlagBitField, extraData: i64 0)
+// CHECK: !224 = !DILocation(line: 319, column: 7, scope: !218)
+// CHECK: !225 = !DILocalVariable(scope: !218, file: !6, line: 320, type: !220)
+// CHECK: !226 = !DILocation(line: 320, column: 8, scope: !218)
+// CHECK: !227 = !DILocation(line: 320, column: 17, scope: !218)
+// CHECK: !228 = !DILocation(line: 321, column: 1, scope: !218)
+// CHECK: !229 = distinct !DISubprogram(name: "S10", linkageName: "_ZN3S10C2Ev", scope: !167, file: !6, line: 241, type: !174, scopeLine: 241, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, declaration: !173, retainedNodes: !9)
+// CHECK: !230 = !DILocalVariable(name: "this", arg: 1, scope: !229, type: !190, flags: DIFlagArtificial | DIFlagObjectPointer)
+// CHECK: !231 = !DILocation(line: 0, scope: !229)
+// CHECK: !232 = !DILocation(line: 241, column: 11, scope: !229)
+// CHECK: !233 = !DILocation(line: 241, column: 17, scope: !229)
+// CHECK: !234 = !DILocation(line: 241, column: 23, scope: !229)
+//.
Index: clang/lib/CodeGen/CGDebugInfo.h
===================================================================
--- clang/lib/CodeGen/CGDebugInfo.h
+++ clang/lib/CodeGen/CGDebugInfo.h
@@ -337,6 +337,9 @@
                                           llvm::DIScope *RecordTy,
                                           const RecordDecl *RD);
 
+  /// Create type for binding declarations.
+  llvm::DIType *CreateBindingDeclType(const BindingDecl *BD);
+
   /// Create an anonnymous zero-size separator for bit-field-decl if needed on
   /// the target.
   llvm::DIDerivedType *createBitFieldSeparatorIfNeeded(
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===================================================================
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -4744,6 +4744,40 @@
   return D;
 }
 
+llvm::DIType *CGDebugInfo::CreateBindingDeclType(const BindingDecl *BD) {
+  llvm::DIFile *Unit = getOrCreateFile(BD->getLocation());
+
+  // If the declaration is bound to a bitfield struct field, its type may have a
+  // size that is different from its deduced declaration type's.
+  if (const MemberExpr *ME = dyn_cast<MemberExpr>(BD->getBinding())) {
+    if (const FieldDecl *FD = dyn_cast<FieldDecl>(ME->getMemberDecl())) {
+      if (FD->isBitField()) {
+        ASTContext &Context = CGM.getContext();
+        const CGRecordLayout &RL =
+            CGM.getTypes().getCGRecordLayout(FD->getParent());
+        const CGBitFieldInfo &Info = RL.getBitFieldInfo(FD);
+
+        // Find an integer type with the same bitwidth as the bitfield size. If
+        // no suitable type is present in the target, give up on producing debug
+        // information as it would be wrong. It is certainly possible to produce
+        // correct debug info, but the logic isn't currently implemented.
+        uint64_t BitfieldSizeInBits = Info.Size;
+        QualType IntTy =
+            Context.getIntTypeForBitwidth(BitfieldSizeInBits, Info.IsSigned);
+        if (IntTy.isNull())
+          return nullptr;
+        Qualifiers Quals = BD->getType().getQualifiers();
+        QualType FinalTy = Context.getQualifiedType(IntTy, Quals);
+        llvm::DIType *Ty = getOrCreateType(FinalTy, Unit);
+        assert(Ty);
+        return Ty;
+      }
+    }
+  }
+
+  return getOrCreateType(BD->getType(), Unit);
+}
+
 llvm::DILocalVariable *CGDebugInfo::EmitDeclare(const BindingDecl *BD,
                                                 llvm::Value *Storage,
                                                 std::optional<unsigned> ArgNo,
@@ -4758,8 +4792,7 @@
   if (isa<DeclRefExpr>(BD->getBinding()))
     return nullptr;
 
-  llvm::DIFile *Unit = getOrCreateFile(BD->getLocation());
-  llvm::DIType *Ty = getOrCreateType(BD->getType(), Unit);
+  llvm::DIType *Ty = CreateBindingDeclType(BD);
 
   // If there is no debug info for this type then do not emit debug info
   // for this variable.
@@ -4785,6 +4818,7 @@
   unsigned Column = getColumnNumber(BD->getLocation());
   StringRef Name = BD->getName();
   auto *Scope = cast<llvm::DIScope>(LexicalBlockStack.back());
+  llvm::DIFile *Unit = getOrCreateFile(BD->getLocation());
   // Create the descriptor for the variable.
   llvm::DILocalVariable *D = DBuilder.createAutoVariable(
       Scope, Name, Unit, Line, Ty, CGM.getLangOpts().Optimize,
@@ -4800,6 +4834,11 @@
       const uint64_t fieldOffset = layout.getFieldOffset(fieldIndex);
 
       if (fieldOffset != 0) {
+        // Currently if the field offset is not a multiple of byte, the produced
+        // location would not be accurate. Therefore give up.
+        if (fieldOffset % CGM.getContext().getCharWidth() != 0)
+          return nullptr;
+
         Expr.push_back(llvm::dwarf::DW_OP_plus_uconst);
         Expr.push_back(
             CGM.getContext().toCharUnitsFromBits(fieldOffset).getQuantity());
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to