Skip to content

[clang][ASTDump] Dump value of structural TemplateArguments #126937

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

Closed

Conversation

Michael137
Copy link
Member

TemplateArgument::ArgKind::StructuralValue was introduced in #78041

The AST dump for such template arguments would yield the following:

|-ClassTemplateSpecializationDecl
  `- TemplateArgument

With this patch we would dump as:

|-ClassTemplateSpecializationDecl
  `-TemplateArgument structural '1.000000e+00'

`TemplateArgument::ArgKind::StructuralValue` was introduced in
llvm#78041

The AST dump for such template arguments would yield the following:
```
|-ClassTemplateSpecializationDecl
  `- TemplateArgument
```

With this patch we would dump as:
```
|-ClassTemplateSpecializationDecl
  `-TemplateArgument structural '1.000000e+00'
```
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Feb 12, 2025
@Michael137 Michael137 requested a review from cor3ntin February 12, 2025 16:29
@llvmbot
Copy link
Member

llvmbot commented Feb 12, 2025

@llvm/pr-subscribers-clang

Author: Michael Buch (Michael137)

Changes

TemplateArgument::ArgKind::StructuralValue was introduced in #78041

The AST dump for such template arguments would yield the following:

|-ClassTemplateSpecializationDecl
  `- TemplateArgument

With this patch we would dump as:

|-ClassTemplateSpecializationDecl
  `-TemplateArgument structural '1.000000e+00'

Patch is 155.45 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/126937.diff

3 Files Affected:

  • (modified) clang/include/clang/AST/TextNodeDumper.h (+1)
  • (modified) clang/lib/AST/TextNodeDumper.cpp (+5)
  • (modified) clang/test/AST/ast-dump-templates.cpp (+679-671)
diff --git a/clang/include/clang/AST/TextNodeDumper.h b/clang/include/clang/AST/TextNodeDumper.h
index bfd205ffb0d99..b0eff62bf9a9f 100644
--- a/clang/include/clang/AST/TextNodeDumper.h
+++ b/clang/include/clang/AST/TextNodeDumper.h
@@ -253,6 +253,7 @@ class TextNodeDumper
   void VisitTemplateExpansionTemplateArgument(const TemplateArgument &TA);
   void VisitExpressionTemplateArgument(const TemplateArgument &TA);
   void VisitPackTemplateArgument(const TemplateArgument &TA);
+  void VisitStructuralValueTemplateArgument(const TemplateArgument &TA);
 
   void VisitIfStmt(const IfStmt *Node);
   void VisitSwitchStmt(const SwitchStmt *Node);
diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp
index 6da1f776b4b63..98f6e8a26ffb1 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";
+  dumpTemplateArgument(TA);
+}
+
 void TextNodeDumper::dumpTemplateName(TemplateName TN, StringRef Label) {
   AddChild(Label, [=] {
     {
diff --git a/clang/test/AST/ast-dump-templates.cpp b/clang/test/AST/ast-dump-templates.cpp
index 86af8c50f3174..11b159b8a5304 100644
--- a/clang/test/AST/ast-dump-templates.cpp
+++ b/clang/test/AST/ast-dump-templates.cpp
@@ -3,6 +3,7 @@
 // RUN: FileCheck < %t %s -check-prefix=CHECK1
 // RUN: FileCheck < %t %s -check-prefix=CHECK2
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -std=c++17 -ast-dump %s | FileCheck --check-prefix=DUMP %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -std=c++20 -ast-dump -DCXX20=1 %s | FileCheck --check-prefix=DUMP-CPP20 %s
 
 // Test with serialization:
 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -std=c++17 -emit-pch -o %t %s
@@ -100,6 +101,13 @@ void test() {
 // differently in this way.
 // CHECK1: {{^    }}template<> struct foo<1, 0 + 0L> {
 template struct foo<1, 0 + 0L>;
+
+#ifdef CXX20
+// DUMP-CPP20: TemplateArgument structural '1.{{.*}}'
+// DUMP-CPP20: TemplateArgument structural '-2.{{.*}}'
+template struct foo<1, 1.0f>;
+template struct foo<1, -2.0>;
+#endif // CXX20
 }
 
 namespace test5 {
@@ -294,22 +302,22 @@ namespace test7 {
 // JSON-NEXT:    "id": "0x{{.*}}",
 // JSON-NEXT:    "kind": "ClassTemplateDecl",
 // JSON-NEXT:    "loc": {
-// JSON-NEXT:     "offset": 812,
+// JSON-NEXT:     "offset": 937,
 // JSON-NEXT:     "file": "{{.*}}",
-// JSON-NEXT:     "line": 15,
+// JSON-NEXT:     "line": 16,
 // JSON-NEXT:     "col": 8,
 // JSON-NEXT:     "tokLen": 3
 // JSON-NEXT:    },
 // JSON-NEXT:    "range": {
 // JSON-NEXT:     "begin": {
-// JSON-NEXT:      "offset": 765,
-// JSON-NEXT:      "line": 14,
+// JSON-NEXT:      "offset": 890,
+// JSON-NEXT:      "line": 15,
 // JSON-NEXT:      "col": 1,
 // JSON-NEXT:      "tokLen": 8
 // JSON-NEXT:     },
 // JSON-NEXT:     "end": {
-// JSON-NEXT:      "offset": 879,
-// JSON-NEXT:      "line": 19,
+// JSON-NEXT:      "offset": 1004,
+// JSON-NEXT:      "line": 20,
 // JSON-NEXT:      "col": 1,
 // JSON-NEXT:      "tokLen": 1
 // JSON-NEXT:     }
@@ -320,19 +328,19 @@ namespace test7 {
 // JSON-NEXT:      "id": "0x{{.*}}",
 // JSON-NEXT:      "kind": "NonTypeTemplateParmDecl",
 // JSON-NEXT:      "loc": {
-// JSON-NEXT:       "offset": 779,
-// JSON-NEXT:       "line": 14,
+// JSON-NEXT:       "offset": 904,
+// JSON-NEXT:       "line": 15,
 // JSON-NEXT:       "col": 15,
 // JSON-NEXT:       "tokLen": 1
 // JSON-NEXT:      },
 // JSON-NEXT:      "range": {
 // JSON-NEXT:       "begin": {
-// JSON-NEXT:        "offset": 775,
+// JSON-NEXT:        "offset": 900,
 // JSON-NEXT:        "col": 11,
 // JSON-NEXT:        "tokLen": 3
 // JSON-NEXT:       },
 // JSON-NEXT:       "end": {
-// JSON-NEXT:        "offset": 779,
+// JSON-NEXT:        "offset": 904,
 // JSON-NEXT:        "col": 15,
 // JSON-NEXT:        "tokLen": 1
 // JSON-NEXT:       }
@@ -349,18 +357,18 @@ namespace test7 {
 // JSON-NEXT:      "id": "0x{{.*}}",
 // JSON-NEXT:      "kind": "TemplateTypeParmDecl",
 // JSON-NEXT:      "loc": {
-// JSON-NEXT:       "offset": 791,
+// JSON-NEXT:       "offset": 916,
 // JSON-NEXT:       "col": 27,
 // JSON-NEXT:       "tokLen": 1
 // JSON-NEXT:      },
 // JSON-NEXT:      "range": {
 // JSON-NEXT:       "begin": {
-// JSON-NEXT:        "offset": 782,
+// JSON-NEXT:        "offset": 907,
 // JSON-NEXT:        "col": 18,
 // JSON-NEXT:        "tokLen": 8
 // JSON-NEXT:       },
 // JSON-NEXT:       "end": {
-// JSON-NEXT:        "offset": 791,
+// JSON-NEXT:        "offset": 916,
 // JSON-NEXT:        "col": 27,
 // JSON-NEXT:        "tokLen": 1
 // JSON-NEXT:       }
@@ -375,18 +383,18 @@ namespace test7 {
 // JSON-NEXT:      "id": "0x{{.*}}",
 // JSON-NEXT:      "kind": "NonTypeTemplateParmDecl",
 // JSON-NEXT:      "loc": {
-// JSON-NEXT:       "offset": 798,
+// JSON-NEXT:       "offset": 923,
 // JSON-NEXT:       "col": 34,
 // JSON-NEXT:       "tokLen": 1
 // JSON-NEXT:      },
 // JSON-NEXT:      "range": {
 // JSON-NEXT:       "begin": {
-// JSON-NEXT:        "offset": 794,
+// JSON-NEXT:        "offset": 919,
 // JSON-NEXT:        "col": 30,
 // JSON-NEXT:        "tokLen": 3
 // JSON-NEXT:       },
 // JSON-NEXT:       "end": {
-// JSON-NEXT:        "offset": 802,
+// JSON-NEXT:        "offset": 927,
 // JSON-NEXT:        "col": 38,
 // JSON-NEXT:        "tokLen": 1
 // JSON-NEXT:       }
@@ -407,12 +415,12 @@ namespace test7 {
 // JSON-NEXT:        "kind": "TemplateArgument",
 // JSON-NEXT:        "range": {
 // JSON-NEXT:         "begin": {
-// JSON-NEXT:          "offset": 802,
+// JSON-NEXT:          "offset": 927,
 // JSON-NEXT:          "col": 38,
 // JSON-NEXT:          "tokLen": 1
 // JSON-NEXT:         },
 // JSON-NEXT:         "end": {
-// JSON-NEXT:          "offset": 802,
+// JSON-NEXT:          "offset": 927,
 // JSON-NEXT:          "col": 38,
 // JSON-NEXT:          "tokLen": 1
 // JSON-NEXT:         }
@@ -424,12 +432,12 @@ namespace test7 {
 // JSON-NEXT:          "kind": "IntegerLiteral",
 // JSON-NEXT:          "range": {
 // JSON-NEXT:           "begin": {
-// JSON-NEXT:            "offset": 802,
+// JSON-NEXT:            "offset": 927,
 // JSON-NEXT:            "col": 38,
 // JSON-NEXT:            "tokLen": 1
 // JSON-NEXT:           },
 // JSON-NEXT:           "end": {
-// JSON-NEXT:            "offset": 802,
+// JSON-NEXT:            "offset": 927,
 // JSON-NEXT:            "col": 38,
 // JSON-NEXT:            "tokLen": 1
 // JSON-NEXT:           }
@@ -448,20 +456,20 @@ namespace test7 {
 // JSON-NEXT:      "id": "0x{{.*}}",
 // JSON-NEXT:      "kind": "CXXRecordDecl",
 // JSON-NEXT:      "loc": {
-// JSON-NEXT:       "offset": 812,
-// JSON-NEXT:       "line": 15,
+// JSON-NEXT:       "offset": 937,
+// JSON-NEXT:       "line": 16,
 // JSON-NEXT:       "col": 8,
 // JSON-NEXT:       "tokLen": 3
 // JSON-NEXT:      },
 // JSON-NEXT:      "range": {
 // JSON-NEXT:       "begin": {
-// JSON-NEXT:        "offset": 805,
+// JSON-NEXT:        "offset": 930,
 // JSON-NEXT:        "col": 1,
 // JSON-NEXT:        "tokLen": 6
 // JSON-NEXT:       },
 // JSON-NEXT:       "end": {
-// JSON-NEXT:        "offset": 879,
-// JSON-NEXT:        "line": 19,
+// JSON-NEXT:        "offset": 1004,
+// JSON-NEXT:        "line": 20,
 // JSON-NEXT:        "col": 1,
 // JSON-NEXT:        "tokLen": 1
 // JSON-NEXT:       }
@@ -517,19 +525,19 @@ namespace test7 {
 // JSON-NEXT:        "id": "0x{{.*}}",
 // JSON-NEXT:        "kind": "CXXRecordDecl",
 // JSON-NEXT:        "loc": {
-// JSON-NEXT:         "offset": 812,
-// JSON-NEXT:         "line": 15,
+// JSON-NEXT:         "offset": 937,
+// JSON-NEXT:         "line": 16,
 // JSON-NEXT:         "col": 8,
 // JSON-NEXT:         "tokLen": 3
 // JSON-NEXT:        },
 // JSON-NEXT:        "range": {
 // JSON-NEXT:         "begin": {
-// JSON-NEXT:          "offset": 805,
+// JSON-NEXT:          "offset": 930,
 // JSON-NEXT:          "col": 1,
 // JSON-NEXT:          "tokLen": 6
 // JSON-NEXT:         },
 // JSON-NEXT:         "end": {
-// JSON-NEXT:          "offset": 812,
+// JSON-NEXT:          "offset": 937,
 // JSON-NEXT:          "col": 8,
 // JSON-NEXT:          "tokLen": 3
 // JSON-NEXT:         }
@@ -543,19 +551,19 @@ namespace test7 {
 // JSON-NEXT:        "id": "0x{{.*}}",
 // JSON-NEXT:        "kind": "FieldDecl",
 // JSON-NEXT:        "loc": {
-// JSON-NEXT:         "offset": 824,
-// JSON-NEXT:         "line": 16,
+// JSON-NEXT:         "offset": 949,
+// JSON-NEXT:         "line": 17,
 // JSON-NEXT:         "col": 7,
 // JSON-NEXT:         "tokLen": 8
 // JSON-NEXT:        },
 // JSON-NEXT:        "range": {
 // JSON-NEXT:         "begin": {
-// JSON-NEXT:          "offset": 820,
+// JSON-NEXT:          "offset": 945,
 // JSON-NEXT:          "col": 3,
 // JSON-NEXT:          "tokLen": 3
 // JSON-NEXT:         },
 // JSON-NEXT:         "end": {
-// JSON-NEXT:          "offset": 824,
+// JSON-NEXT:          "offset": 949,
 // JSON-NEXT:          "col": 7,
 // JSON-NEXT:          "tokLen": 8
 // JSON-NEXT:         }
@@ -569,19 +577,19 @@ namespace test7 {
 // JSON-NEXT:        "id": "0x{{.*}}",
 // JSON-NEXT:        "kind": "CXXConstructorDecl",
 // JSON-NEXT:        "loc": {
-// JSON-NEXT:         "offset": 836,
-// JSON-NEXT:         "line": 17,
+// JSON-NEXT:         "offset": 961,
+// JSON-NEXT:         "line": 18,
 // JSON-NEXT:         "col": 3,
 // JSON-NEXT:         "tokLen": 3
 // JSON-NEXT:        },
 // JSON-NEXT:        "range": {
 // JSON-NEXT:         "begin": {
-// JSON-NEXT:          "offset": 836,
+// JSON-NEXT:          "offset": 961,
 // JSON-NEXT:          "col": 3,
 // JSON-NEXT:          "tokLen": 3
 // JSON-NEXT:         },
 // JSON-NEXT:         "end": {
-// JSON-NEXT:          "offset": 843,
+// JSON-NEXT:          "offset": 968,
 // JSON-NEXT:          "col": 10,
 // JSON-NEXT:          "tokLen": 1
 // JSON-NEXT:         }
@@ -596,12 +604,12 @@ namespace test7 {
 // JSON-NEXT:          "kind": "CompoundStmt",
 // JSON-NEXT:          "range": {
 // JSON-NEXT:           "begin": {
-// JSON-NEXT:            "offset": 842,
+// JSON-NEXT:            "offset": 967,
 // JSON-NEXT:            "col": 9,
 // JSON-NEXT:            "tokLen": 1
 // JSON-NEXT:           },
 // JSON-NEXT:           "end": {
-// JSON-NEXT:            "offset": 843,
+// JSON-NEXT:            "offset": 968,
 // JSON-NEXT:            "col": 10,
 // JSON-NEXT:            "tokLen": 1
 // JSON-NEXT:           }
@@ -613,19 +621,19 @@ namespace test7 {
 // JSON-NEXT:        "id": "0x{{.*}}",
 // JSON-NEXT:        "kind": "CXXMethodDecl",
 // JSON-NEXT:        "loc": {
-// JSON-NEXT:         "offset": 849,
-// JSON-NEXT:         "line": 18,
+// JSON-NEXT:         "offset": 974,
+// JSON-NEXT:         "line": 19,
 // JSON-NEXT:         "col": 5,
 // JSON-NEXT:         "tokLen": 6
 // JSON-NEXT:        },
 // JSON-NEXT:        "range": {
 // JSON-NEXT:         "begin": {
-// JSON-NEXT:          "offset": 847,
+// JSON-NEXT:          "offset": 972,
 // JSON-NEXT:          "col": 3,
 // JSON-NEXT:          "tokLen": 1
 // JSON-NEXT:         },
 // JSON-NEXT:         "end": {
-// JSON-NEXT:          "offset": 877,
+// JSON-NEXT:          "offset": 1002,
 // JSON-NEXT:          "col": 33,
 // JSON-NEXT:          "tokLen": 1
 // JSON-NEXT:         }
@@ -640,12 +648,12 @@ namespace test7 {
 // JSON-NEXT:          "kind": "CompoundStmt",
 // JSON-NEXT:          "range": {
 // JSON-NEXT:           "begin": {
-// JSON-NEXT:            "offset": 858,
+// JSON-NEXT:            "offset": 983,
 // JSON-NEXT:            "col": 14,
 // JSON-NEXT:            "tokLen": 1
 // JSON-NEXT:           },
 // JSON-NEXT:           "end": {
-// JSON-NEXT:            "offset": 877,
+// JSON-NEXT:            "offset": 1002,
 // JSON-NEXT:            "col": 33,
 // JSON-NEXT:            "tokLen": 1
 // JSON-NEXT:           }
@@ -656,12 +664,12 @@ namespace test7 {
 // JSON-NEXT:            "kind": "ReturnStmt",
 // JSON-NEXT:            "range": {
 // JSON-NEXT:             "begin": {
-// JSON-NEXT:              "offset": 860,
+// JSON-NEXT:              "offset": 985,
 // JSON-NEXT:              "col": 16,
 // JSON-NEXT:              "tokLen": 6
 // JSON-NEXT:             },
 // JSON-NEXT:             "end": {
-// JSON-NEXT:              "offset": 874,
+// JSON-NEXT:              "offset": 999,
 // JSON-NEXT:              "col": 30,
 // JSON-NEXT:              "tokLen": 1
 // JSON-NEXT:             }
@@ -672,12 +680,12 @@ namespace test7 {
 // JSON-NEXT:              "kind": "CXXUnresolvedConstructExpr",
 // JSON-NEXT:              "range": {
 // JSON-NEXT:               "begin": {
-// JSON-NEXT:                "offset": 867,
+// JSON-NEXT:                "offset": 992,
 // JSON-NEXT:                "col": 23,
 // JSON-NEXT:                "tokLen": 1
 // JSON-NEXT:               },
 // JSON-NEXT:               "end": {
-// JSON-NEXT:                "offset": 874,
+// JSON-NEXT:                "offset": 999,
 // JSON-NEXT:                "col": 30,
 // JSON-NEXT:                "tokLen": 1
 // JSON-NEXT:               }
@@ -692,12 +700,12 @@ namespace test7 {
 // JSON-NEXT:                "kind": "BinaryOperator",
 // JSON-NEXT:                "range": {
 // JSON-NEXT:                 "begin": {
-// JSON-NEXT:                  "offset": 869,
+// JSON-NEXT:                  "offset": 994,
 // JSON-NEXT:                  "col": 25,
 // JSON-NEXT:                  "tokLen": 1
 // JSON-NEXT:                 },
 // JSON-NEXT:                 "end": {
-// JSON-NEXT:                  "offset": 873,
+// JSON-NEXT:                  "offset": 998,
 // JSON-NEXT:                  "col": 29,
 // JSON-NEXT:                  "tokLen": 1
 // JSON-NEXT:                 }
@@ -713,12 +721,12 @@ namespace test7 {
 // JSON-NEXT:                  "kind": "DeclRefExpr",
 // JSON-NEXT:                  "range": {
 // JSON-NEXT:                   "begin": {
-// JSON-NEXT:                    "offset": 869,
+// JSON-NEXT:                    "offset": 994,
 // JSON-NEXT:                    "col": 25,
 // JSON-NEXT:                    "tokLen": 1
 // JSON-NEXT:                   },
 // JSON-NEXT:                   "end": {
-// JSON-NEXT:                    "offset": 869,
+// JSON-NEXT:                    "offset": 994,
 // JSON-NEXT:                    "col": 25,
 // JSON-NEXT:                    "tokLen": 1
 // JSON-NEXT:                   }
@@ -741,12 +749,12 @@ namespace test7 {
 // JSON-NEXT:                  "kind": "DeclRefExpr",
 // JSON-NEXT:                  "range": {
 // JSON-NEXT:                   "begin": {
-// JSON-NEXT:                    "offset": 873,
+// JSON-NEXT:                    "offset": 998,
 // JSON-NEXT:                    "col": 29,
 // JSON-NEXT:                    "tokLen": 1
 // JSON-NEXT:                   },
 // JSON-NEXT:                   "end": {
-// JSON-NEXT:                    "offset": 873,
+// JSON-NEXT:                    "offset": 998,
 // JSON-NEXT:                    "col": 29,
 // JSON-NEXT:                    "tokLen": 1
 // JSON-NEXT:                   }
@@ -780,21 +788,21 @@ namespace test7 {
 // JSON-NEXT:      "id": "0x{{.*}}",
 // JSON-NEXT:      "kind": "ClassTemplateSpecializationDecl",
 // JSON-NEXT:      "loc": {
-// JSON-NEXT:       "offset": 812,
-// JSON-NEXT:       "line": 15,
+// JSON-NEXT:       "offset": 937,
+// JSON-NEXT:       "line": 16,
 // JSON-NEXT:       "col": 8,
 // JSON-NEXT:       "tokLen": 3
 // JSON-NEXT:      },
 // JSON-NEXT:      "range": {
 // JSON-NEXT:       "begin": {
-// JSON-NEXT:        "offset": 765,
-// JSON-NEXT:        "line": 14,
+// JSON-NEXT:        "offset": 890,
+// JSON-NEXT:        "line": 15,
 // JSON-NEXT:        "col": 1,
 // JSON-NEXT:        "tokLen": 8
 // JSON-NEXT:       },
 // JSON-NEXT:       "end": {
-// JSON-NEXT:        "offset": 879,
-// JSON-NEXT:        "line": 19,
+// JSON-NEXT:        "offset": 1004,
+// JSON-NEXT:        "line": 20,
 // JSON-NEXT:        "col": 1,
 // JSON-NEXT:        "tokLen": 1
 // JSON-NEXT:       }
@@ -871,19 +879,19 @@ namespace test7 {
 // JSON-NEXT:        "id": "0x{{.*}}",
 // JSON-NEXT:        "kind": "CXXRecordDecl",
 // JSON-NEXT:        "loc": {
-// JSON-NEXT:         "offset": 812,
-// JSON-NEXT:         "line": 15,
+// JSON-NEXT:         "offset": 937,
+// JSON-NEXT:         "line": 16,
 // JSON-NEXT:         "col": 8,
 // JSON-NEXT:         "tokLen": 3
 // JSON-NEXT:        },
 // JSON-NEXT:        "range": {
 // JSON-NEXT:         "begin": {
-// JSON-NEXT:          "offset": 805,
+// JSON-NEXT:          "offset": 930,
 // JSON-NEXT:          "col": 1,
 // JSON-NEXT:          "tokLen": 6
 // JSON-NEXT:         },
 // JSON-NEXT:         "end": {
-// JSON-NEXT:          "offset": 812,
+// JSON-NEXT:          "offset": 937,
 // JSON-NEXT:          "col": 8,
 // JSON-NEXT:          "tokLen": 3
 // JSON-NEXT:         }
@@ -896,19 +904,19 @@ namespace test7 {
 // JSON-NEXT:        "id": "0x{{.*}}",
 // JSON-NEXT:        "kind": "FieldDecl",
 // JSON-NEXT:        "loc": {
-// JSON-NEXT:         "offset": 824,
-// JSON-NEXT:         "line": 16,
+// JSON-NEXT:         "offset": 949,
+// JSON-NEXT:         "line": 17,
 // JSON-NEXT:         "col": 7,
 // JSON-NEXT:         "tokLen": 8
 // JSON-NEXT:        },
 // JSON-NEXT:        "range": {
 // JSON-NEXT:         "begin": {
-// JSON-NEXT:          "offset": 820,
+// JSON-NEXT:          "offset": 945,
 // JSON-NEXT:          "col": 3,
 // JSON-NEXT:          "tokLen": 3
 // JSON-NEXT:         },
 // JSON-NEXT:         "end": {
-// JSON-NEXT:          "offset": 824,
+// JSON-NEXT:          "offset": 949,
 // JSON-NEXT:          "col": 7,
 // JSON-NEXT:          "tokLen": 8
 // JSON-NEXT:         }
@@ -922,19 +930,19 @@ namespace test7 {
 // JSON-NEXT:        "id": "0x{{.*}}",
 // JSON-NEXT:        "kind": "CXXConstructorDecl",
 // JSON-NEXT:        "loc": {
-// JSON-NEXT:         "offset": 836,
-// JSON-NEXT:         "line": 17,
+// JSON-NEXT:         "offset": 961,
+// JSON-NEXT:         "line": 18,
 // JSON-NEXT:         "col": 3,
 // JSON-NEXT:         "tokLen": 3
 // JSON-NEXT:        },
 // JSON-NEXT:        "range": {
 // JSON-NEXT:         "begin": {
-// JSON-NEXT:          "offset": 836,
+// JSON-NEXT:          "offset": 961,
 // JSON-NEXT:          "col": 3,
 // JSON-NEXT:          "tokLen": 3
 // JSON-NEXT:         },
 // JSON-NEXT:         "end": {
-// JSON-NEXT:          "offset": 843,
+// JSON-NEXT:          "offset": 968,
 // JSON-NEXT:          "col": 10,
 // JSON-NEXT:          "tokLen": 1
 // JSON-NEXT:         }
@@ -951,12 +959,12 @@ namespace test7 {
 // JSON-NEXT:          "kind": "CompoundStmt",
 // JSON-NEXT:          "range": {
 // JSON-NEXT:           "begin": {
-// JSON-NEXT:            "offset": 842,
+// JSON-NEXT:            "offset": 967,
 // JSON-NEXT:            "col": 9,
 // JSON-NEXT:            "tokLen": 1
 // JSON-NEXT:           },
 // JSON-NEXT:           "end": {
-// JSON-NEXT:            "offset": 843,
+// JSON-NEXT:            "offset": 968,
 // JSON-NEXT:            "col": 10,
 // JSON-NEXT:            "tokLen": 1
 // JSON-NEXT:           }
@@ -968,19 +976,19 @@ namespace test7 {
 // JSON-NEXT:        "id": "0x{{.*}}",
 // JSON-NEXT:        "kind": "CXXMethodDecl",
 // JSON-NEXT:        "loc": {
-// JSON-NEXT:         "offset": 849,
-// JSON-NEXT:         "line": 18,
+// JSON-NEXT:         "offset": 974,
+// JSON-NEXT:         "line": 19,
 // JSON-NEXT:         "col": 5,
 // JSON-NEXT:         "tokLen": 6
 // JSON-NEXT:        },
 // JSON-NEXT:        "range": {
 // JSON-NEXT:         "begin": {
-// JSON-NEXT:          "offset": 847,
+// JSON-NEXT:          "offset": 972,
 // JSON-NEXT:          "col": 3,
 // JSON-NEXT:          "tokLen": 1
 // JSON-NEXT:         },
 // JSON-NEXT:         "end": {
-// JSON-NEXT:          "offset": 877,
+// JSON-NEXT:          "offset": 1002,
 // JSON-NEXT:          "col": 33,
 // JSON-NEXT:          "tokLen": 1
 // JSON-NEXT:         }
@@ -997,12 +1005,12 @@ namespace test7 {
 // JSON-NEXT:          "kind": "CompoundStmt",
 // JSON-NEXT:          "range": {
 // JSON-NEXT:           "begin": {
-// JSON-NEXT:            "offset": 858,
+// JSON-NEXT:            "offset": 983,
 // JSON-NEXT:            "col": 14,
 // JSON-NEXT:            "tokLen": 1
 // JSON-NEXT:           },
 // JSON-NEXT:           "end": {
-// JSON-...
[truncated]

Copy link

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff e258bca9505f35e0a22cb213a305eea9b76d11ea 5fffbe4f50a9870ec778db840abd02655efe670a --extensions h,cpp -- clang/include/clang/AST/TextNodeDumper.h clang/lib/AST/TextNodeDumper.cpp clang/test/AST/ast-dump-templates.cpp
View the diff from clang-format here.
diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp
index 98f6e8a26f..cd6be32bff 100644
--- a/clang/lib/AST/TextNodeDumper.cpp
+++ b/clang/lib/AST/TextNodeDumper.cpp
@@ -1226,7 +1226,8 @@ void TextNodeDumper::VisitIntegralTemplateArgument(const TemplateArgument &TA) {
   dumpTemplateArgument(TA);
 }
 
-void TextNodeDumper::VisitStructuralValueTemplateArgument(const TemplateArgument &TA) {
+void TextNodeDumper::VisitStructuralValueTemplateArgument(
+    const TemplateArgument &TA) {
   OS << " structural";
   dumpTemplateArgument(TA);
 }

@zyn0217
Copy link
Contributor

zyn0217 commented Feb 12, 2025

FYI #126341 is doing exactly the same thing

@Michael137
Copy link
Member Author

ah fair enough
lets get that one merged then

@Michael137 Michael137 closed this Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants