llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Michael Buch (Michael137) <details> <summary>Changes</summary> This exercises the codepath where we create `DITemplateValueParameter`s whose `TemplateArgument::ArgKind` is `StructuralValue`, which was added in (https://github.com/llvm/llvm-project/pull/78041). Previously, not emitting a `value`/`defaulted` for such template argument nodes didn't fail any tests. --- Full diff: https://github.com/llvm/llvm-project/pull/127056.diff 1 Files Affected: - (modified) clang/test/CodeGenCXX/debug-info-template-parameter.cpp (+25) ``````````diff diff --git a/clang/test/CodeGenCXX/debug-info-template-parameter.cpp b/clang/test/CodeGenCXX/debug-info-template-parameter.cpp index 360cc1fb30784..b180cf3a1a75c 100644 --- a/clang/test/CodeGenCXX/debug-info-template-parameter.cpp +++ b/clang/test/CodeGenCXX/debug-info-template-parameter.cpp @@ -4,6 +4,7 @@ // RUN: %clang_cc1 -emit-llvm %std_cxx11-14 -dwarf-version=5 -triple x86_64 %s -O0 -disable-llvm-passes -debug-info-kind=standalone -o - | FileCheck %s --check-prefixes=CHECK,PRE17 // RUN: %clang_cc1 -emit-llvm %std_cxx17- -dwarf-version=5 -triple x86_64 %s -O0 -disable-llvm-passes -debug-info-kind=standalone -o - | FileCheck %s --check-prefixes=CHECK,CXX17 // RUN: %clang_cc1 -emit-llvm %std_cxx17- -dwarf-version=4 -triple x86_64 %s -O0 -disable-llvm-passes -debug-info-kind=standalone -o - | FileCheck %s --check-prefixes=CHECK,CXX17 +// RUN: %clang_cc1 -emit-llvm %std_cxx20- -dwarf-version=5 -DCXX20=1 -triple x86_64 %s -O0 -disable-llvm-passes -debug-info-kind=standalone -o - | FileCheck %s --check-prefix=CHECK-CXX20 // CHECK: DILocalVariable(name: "f1", {{.*}}, type: ![[TEMPLATE_TYPE:[0-9]+]] // CHECK: [[TEMPLATE_TYPE]] = {{.*}}!DICompositeType({{.*}}, templateParams: ![[F1_TYPE:[0-9]+]] @@ -50,10 +51,34 @@ template <template <typename T> class CT = bar> class baz { }; +#ifdef CXX20 +struct non_empty { int mem; int mem2; } ne; + +template<float f = -1.5f, double d = 5.2, int * p = &ne.mem2> +class nttp {}; +nttp<> n1; + +// CHECK-CXX20: DIGlobalVariable(name: "n1", {{.*}}, type: ![[NTTP_TYPE:[0-9]+]] +// CHECK-CXX20: [[NTTP_TYPE]] = {{.*}}!DICompositeType({{.*}}name: "nttp +// CHECK-CXX20-SAME: templateParams: ![[NTTP_TEMPLATES:[0-9]+]] +// CHECK-CXX20: [[NTTP_TEMPLATES]] = !{![[FIRST:[0-9]+]], ![[SECOND:[0-9]+]], ![[THIRD:[0-9]+]]} +// CHECK-CXX20: [[FIRST]] = !DITemplateValueParameter(name: "f" +// CHECK-CXX20-SAME: defaulted: true +// CHECK-CXX20-SAME: value: float -1.500000e+00 +// CHECK-CXX20: [[SECOND]] = !DITemplateValueParameter(name: "d" +// CHECK-CXX20-SAME: defaulted: true +// CHECK-CXX20-SAME: value: double 5.200000e+00 +// CHECK-CXX20: [[THIRD]] = !DITemplateValueParameter(name: "p" +// CHECK-CXX20-SAME: defaulted: true +// CHECK-CXX20-SAME: value: ptr getelementptr (i8, ptr @ne, i64 4) + +#endif // CXX20 + int main() { foo<int, 6, false, 3, double> f1; foo<> f2; baz<qux> b1; baz<> b2; + return 0; } `````````` </details> https://github.com/llvm/llvm-project/pull/127056 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits