1- // RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone -triple %itanium_abi_triple %s -o - | FileCheck %s --implicit-check-not="call void @llvm.dbg.declare"
1+ // RUN: %clang_cc1 -std=c++23 - emit-llvm -debug-info-kind=standalone -triple %itanium_abi_triple %s -o - | FileCheck %s --implicit-check-not="call void @llvm.dbg.declare"
22
33// CHECK: define {{.*}} i32 @_Z1fv
44// CHECK: #dbg_declare(ptr %{{[a-z]+}}, ![[VAR_0:[0-9]+]], !DIExpression(),
1111// CHECK: #dbg_declare(ptr %k, ![[VAR_7:[0-9]+]], !DIExpression()
1212// CHECK: #dbg_declare(ptr %v, ![[VAR_8:[0-9]+]], !DIExpression()
1313// CHECK: #dbg_declare(ptr %w, ![[VAR_9:[0-9]+]], !DIExpression()
14+ // CHECK: #dbg_declare(ptr %m, ![[VAR_10:[0-9]+]], !DIExpression()
15+ // CHECK: #dbg_declare(ptr %n, ![[VAR_11:[0-9]+]], !DIExpression()
16+ // CHECK: #dbg_declare(ptr %s, ![[VAR_12:[0-9]+]], !DIExpression()
17+ // CHECK: #dbg_declare(ptr %p, ![[VAR_13:[0-9]+]], !DIExpression()
1418// CHECK: ![[VAR_0]] = !DILocalVariable(name: "a"
1519// CHECK: ![[VAR_1]] = !DILocalVariable(name: "x1", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, type: !{{[0-9]+}})
1620// CHECK: ![[VAR_2]] = !DILocalVariable(name: "y1", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, type: !{{[0-9]+}})
2125// CHECK: ![[VAR_7]] = !DILocalVariable(name: "k", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, type: !{{[0-9]+}})
2226// CHECK: ![[VAR_8]] = !DILocalVariable(name: "v", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, type: !{{[0-9]+}})
2327// CHECK: ![[VAR_9]] = !DILocalVariable(name: "w", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, type: !{{[0-9]+}})
28+ // CHECK: ![[VAR_10]] = !DILocalVariable(name: "m", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, type: !{{[0-9]+}})
29+ // CHECK: ![[VAR_11]] = !DILocalVariable(name: "n", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, type: !{{[0-9]+}})
30+ // CHECK: ![[VAR_12]] = !DILocalVariable(name: "s", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, type: !{{[0-9]+}})
31+ // CHECK: ![[VAR_13]] = !DILocalVariable(name: "p", scope: !{{[0-9]+}}, file: !{{[0-9]+}}, line: {{[0-9]+}}, type: !{{[0-9]+}})
2432
2533struct A {
2634 int x;
@@ -35,6 +43,22 @@ struct B {
3543 template <> int get<1 >() { return z; }
3644};
3745
46+ struct C {
47+ int w;
48+ int z;
49+ template <int > int get (this C&& self);
50+ template <> int get<0 >(this C&& self) { return self.w ; }
51+ template <> int get<1 >(this C&& self) { return self.z ; }
52+ };
53+
54+ struct D {
55+ int w;
56+ int z;
57+ template <int > int get (int unused = 0 );
58+ template <> int get<0 >(int unused) { return w; }
59+ template <> int get<1 >(int unused) { return z; }
60+ };
61+
3862// Note: the following declarations are necessary for decomposition of tuple-like
3963// structured bindings
4064namespace std {
@@ -45,6 +69,16 @@ struct tuple_size<B> {
4569 static constexpr unsigned value = 2 ;
4670};
4771
72+ template <>
73+ struct tuple_size <C> {
74+ static constexpr unsigned value = 2 ;
75+ };
76+
77+ template <>
78+ struct tuple_size <D> {
79+ static constexpr unsigned value = 2 ;
80+ };
81+
4882template <unsigned , typename T> struct tuple_element { using type = int ; };
4983
5084// Decomposition of tuple-like bindings but where the `get` methods
@@ -72,5 +106,7 @@ int f() {
72106 auto &[x2, y2] = a;
73107 auto [z1, z2] = B{1 , 2 };
74108 auto [k, v, w] = std::triple{3 , 4 , 5 };
75- return x1 + y1 + x2 + y2 + z1 + z2 + k + v + w;
109+ auto [m, n] = C{2 , 3 };
110+ auto [s, p] = D{2 , 3 };
111+ return x1 + y1 + x2 + y2 + z1 + z2 + k + v + w + m + n + s + p;
76112}
0 commit comments