[clang] [Clang][DebugInfo] Clang generates an extra spurious unnamed 'dbg.declare' (PR #69681)

Orlando Cazalet-Hyams via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 20 03:36:32 PDT 2023


================
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone %s -o - | FileCheck %s
+
+struct Tuple {
+  int Fld_1;
+  int Fld_2;
+};
+__attribute__((optnone)) Tuple get() { return {10, 20}; }
+
+// CHECK-LABEL: define dso_local noundef i32 @main
+// CHECK:      %retval = alloca i32, align 4
+// CHECK-NEXT: [[T0:%.*]] = alloca %struct.Tuple, align 4
+// CHECK:      call void @llvm.dbg.declare(metadata ptr [[T0]], metadata {{.*}}, metadata !DIExpression())
+// CHECK:      call void @llvm.dbg.declare(metadata ptr [[T0]], metadata {{.*}}, metadata !DIExpression(DW_OP_plus_uconst, {{[0-9]+}}))
+// CHECK-NOT:  call void @llvm.dbg.declare(metadata ptr [[T0]], metadata {{.*}}, metadata !DIExpression())
----------------
OCHyams wrote:

It doesn't look like this test covers anything that `clang/test/CodeGenCXX/debug-info-structured-binding.cpp` doesn't already?

IMO no need to add this one. Please can you modify the other test to check that the DILocalVariables in the dbg.declares have the expected names (i.e., confirm there's no unnamed variable).

https://github.com/llvm/llvm-project/pull/69681


More information about the cfe-commits mailing list