-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[clang][DebugInfo][test] Add tests for C++20 non-type template parameters #127056
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ters This exercises the codepath where we create `DITemplateValueParameter`s whose `TemplateArgument::ArgKind` is `StructuralValue`, which was added in (llvm#78041). Previously, not emitting a `value`/`defaulted` for such template argument nodes didn't fail any tests.
@llvm/pr-subscribers-clang Author: Michael Buch (Michael137) ChangesThis exercises the codepath where we create Full diff: https://github.com/llvm/llvm-project/pull/127056.diff 1 Files Affected:
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;
}
|
adrian-prantl
approved these changes
Feb 13, 2025
joaosaffran
pushed a commit
to joaosaffran/llvm-project
that referenced
this pull request
Feb 14, 2025
…ters (llvm#127056) This exercises the codepath where we create `DITemplateValueParameter`s whose `TemplateArgument::ArgKind` is `StructuralValue`, which was added in (llvm#78041). Previously, not emitting a `value`/`defaulted` for such template argument nodes didn't fail any tests.
sivan-shani
pushed a commit
to sivan-shani/llvm-project
that referenced
this pull request
Feb 24, 2025
…ters (llvm#127056) This exercises the codepath where we create `DITemplateValueParameter`s whose `TemplateArgument::ArgKind` is `StructuralValue`, which was added in (llvm#78041). Previously, not emitting a `value`/`defaulted` for such template argument nodes didn't fail any tests.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This exercises the codepath where we create
DITemplateValueParameter
s whoseTemplateArgument::ArgKind
isStructuralValue
, which was added in (#78041). Previously, not emitting avalue
/defaulted
for such template argument nodes didn't fail any tests.