-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[clang] [ASTDump] Add support for structural value template arguments in TextNodeDumper #126341
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
Conversation
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
@llvm/pr-subscribers-clang Author: None (sakria9) ChangesDump structural value in AST. Example code template<_Complex int x>
struct E;
template<>
struct E<{1, 2}>; Command Current AST dump result
After apply this fix
Full diff: https://github.com/llvm/llvm-project/pull/126341.diff 2 Files Affected:
diff --git a/clang/include/clang/AST/TextNodeDumper.h b/clang/include/clang/AST/TextNodeDumper.h
index bfd205ffb0d99a..4b5ad2b5fa74c0 100644
--- a/clang/include/clang/AST/TextNodeDumper.h
+++ b/clang/include/clang/AST/TextNodeDumper.h
@@ -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);
diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp
index 6da1f776b4b635..cb0c742177d2c7 100644
--- a/clang/lib/AST/TextNodeDumper.cpp
+++ b/clang/lib/AST/TextNodeDumper.cpp
@@ -1226,6 +1226,11 @@ 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, [=] {
{
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch. This needs a test and a release note.
@zyn0217 Hi, I have added a test and modfied the release note. Please take a look. Test log:
|
@@ -0,0 +1,12 @@ | |||
// RUN: %clang_cc1 -std=c++20 -ast-dump -ast-dump-filter=pr126341 %s | FileCheck %s |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved.
@zyn0217 Hi, I have 1) modified the release note 2) moved the test 3) supported dump structural value in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
@sakria9 Congratulations on having your first Pull Request (PR) merged into the LLVM Project! Your changes will be combined with recent changes from other authors, then tested by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR. Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues. How to do this, and the rest of the post-merge process, is covered in detail here. If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again. If you don't get any reports, no action is required from you. Your changes are working as expected, well done! |
… in TextNodeDumper (llvm#126341) It was missed in 5518a9d which introduced this new template argument kind.
… in TextNodeDumper (llvm#126341) It was missed in 5518a9d which introduced this new template argument kind.
… in TextNodeDumper (llvm#126341) It was missed in 5518a9d which introduced this new template argument kind.
Dump structural value in AST.
Example code
Command
clang++ -Xclang -ast-dump usr.cpp -fsyntax-only -std=c++23
Current AST dump result
After apply this fix