Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ ABI Changes in This Version
AST Dumping Potentially Breaking Changes
----------------------------------------

- Added support for dumping structural value template arguments in AST dumps. (#GH126341)

Clang Frontend Potentially Breaking Changes
-------------------------------------------

Expand Down
1 change: 1 addition & 0 deletions clang/include/clang/AST/TextNodeDumper.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ class TextNodeDumper
void VisitDeclarationTemplateArgument(const TemplateArgument &TA);
void VisitNullPtrTemplateArgument(const TemplateArgument &TA);
void VisitIntegralTemplateArgument(const TemplateArgument &TA);
void VisitStructuralValueTemplateArgument(const TemplateArgument &TA);
void VisitTemplateTemplateArgument(const TemplateArgument &TA);
void VisitTemplateExpansionTemplateArgument(const TemplateArgument &TA);
void VisitExpressionTemplateArgument(const TemplateArgument &TA);
Expand Down
6 changes: 6 additions & 0 deletions clang/lib/AST/TextNodeDumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,12 @@ void TextNodeDumper::VisitIntegralTemplateArgument(const TemplateArgument &TA) {
dumpTemplateArgument(TA);
}

void TextNodeDumper::VisitStructuralValueTemplateArgument(
const TemplateArgument &TA) {
OS << " structural value";
dumpTemplateArgument(TA);
}

void TextNodeDumper::dumpTemplateName(TemplateName TN, StringRef Label) {
AddChild(Label, [=] {
{
Expand Down
12 changes: 12 additions & 0 deletions clang/test/AST/ast-dump-template-argument-structural-value.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// RUN: %clang_cc1 -std=c++20 -ast-dump -ast-dump-filter=pr126341 %s | FileCheck %s
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you consolidate the test into a pre-existing file e.g. AST/ast-dump-templates.cpp?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved.


template<_Complex int x>
struct pr126341;
template<>
struct pr126341<{1, 2}>;

// CHECK: Dumping pr126341:
// CHECK-NEXT: ClassTemplateDecl
// CHECK: Dumping pr126341:
// CHECK-NEXT: ClassTemplateSpecializationDecl
// CHECK-NEXT: `-TemplateArgument structural value '1+2i'