[clang] 5eca1d5 - AST dump: recurse into type template arguments when dumping.
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 23 00:07:11 PDT 2020
Author: Richard Smith
Date: 2020-06-23T00:07:00-07:00
New Revision: 5eca1d5e0d22a2a578370fdc780cd4003e28ad61
URL: https://github.com/llvm/llvm-project/commit/5eca1d5e0d22a2a578370fdc780cd4003e28ad61
DIFF: https://github.com/llvm/llvm-project/commit/5eca1d5e0d22a2a578370fdc780cd4003e28ad61.diff
LOG: AST dump: recurse into type template arguments when dumping.
Also, do not dump the desugared type for a TemplateSpecializationType
twice.
Added:
Modified:
clang/include/clang/AST/ASTNodeTraverser.h
clang/test/AST/ast-dump-decl.cpp
clang/test/AST/ast-dump-openmp-begin-declare-variant_template_1.cpp
clang/test/AST/ast-dump-template-decls-json.cpp
clang/test/AST/ast-dump-template-decls.cpp
clang/test/AST/float16.cpp
clang/unittests/AST/ASTTraverserTest.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/AST/ASTNodeTraverser.h b/clang/include/clang/AST/ASTNodeTraverser.h
index c146c24a3d36..7462120e3765 100644
--- a/clang/include/clang/AST/ASTNodeTraverser.h
+++ b/clang/include/clang/AST/ASTNodeTraverser.h
@@ -352,8 +352,6 @@ class ASTNodeTraverser
void VisitTemplateSpecializationType(const TemplateSpecializationType *T) {
for (const auto &Arg : *T)
Visit(Arg);
- if (T->isTypeAlias())
- Visit(T->getAliasedType());
}
void VisitObjCObjectPointerType(const ObjCObjectPointerType *T) {
Visit(T->getPointeeType());
@@ -690,6 +688,11 @@ class ASTNodeTraverser
void VisitExpressionTemplateArgument(const TemplateArgument &TA) {
Visit(TA.getAsExpr());
}
+
+ void VisitTypeTemplateArgument(const TemplateArgument &TA) {
+ Visit(TA.getAsType());
+ }
+
void VisitPackTemplateArgument(const TemplateArgument &TA) {
for (const auto &TArg : TA.pack_elements())
Visit(TArg);
diff --git a/clang/test/AST/ast-dump-decl.cpp b/clang/test/AST/ast-dump-decl.cpp
index 3809683bd9dc..b9b7cba394f5 100644
--- a/clang/test/AST/ast-dump-decl.cpp
+++ b/clang/test/AST/ast-dump-decl.cpp
@@ -224,19 +224,27 @@ namespace testFunctionTemplateDecl {
// CHECK-NEXT: | `-CompoundStmt 0x{{.+}} <col:53, col:55>
// CHECK-NEXT: |-FunctionDecl 0x{{.+}} <col:24, col:55> col:29 used TestFunctionTemplate 'void (testFunctionTemplateDecl::A)'
// CHECK-NEXT: | |-TemplateArgument type 'testFunctionTemplateDecl::A'
+ // CHECK-NEXT: | | `-RecordType 0{{.+}} 'testFunctionTemplateDecl::A'
+ // CHECK-NEXT: | | `-CXXRecord 0x{{.+}} 'A'
// CHECK-NEXT: | |-ParmVarDecl 0x{{.+}} <col:50> col:51 'testFunctionTemplateDecl::A':'testFunctionTemplateDecl::A'
// CHECK-NEXT: | `-CompoundStmt 0x{{.+}} <col:53, col:55>
// CHECK-NEXT: |-Function 0x{{.+}} 'TestFunctionTemplate' 'void (testFunctionTemplateDecl::B)'
// CHECK-NEXT: |-FunctionDecl 0x{{.+}} <col:24, col:55> col:29 TestFunctionTemplate 'void (testFunctionTemplateDecl::C)'
// CHECK-NEXT: | |-TemplateArgument type 'testFunctionTemplateDecl::C'
+ // CHECK-NEXT: | | `-RecordType 0{{.+}} 'testFunctionTemplateDecl::C'
+ // CHECK-NEXT: | | `-CXXRecord 0x{{.+}} 'C'
// CHECK-NEXT: | `-ParmVarDecl 0x{{.+}} <col:50> col:51 'testFunctionTemplateDecl::C':'testFunctionTemplateDecl::C'
// CHECK-NEXT: `-FunctionDecl 0x{{.+}} <col:24, col:55> col:29 TestFunctionTemplate 'void (testFunctionTemplateDecl::D)'
// CHECK-NEXT: |-TemplateArgument type 'testFunctionTemplateDecl::D'
+ // CHECK-NEXT: | `-RecordType 0{{.+}} 'testFunctionTemplateDecl::D'
+ // CHECK-NEXT: | `-CXXRecord 0x{{.+}} 'D'
// CHECK-NEXT: |-ParmVarDecl 0x{{.+}} <col:50> col:51 'testFunctionTemplateDecl::D':'testFunctionTemplateDecl::D'
// CHECK-NEXT: `-CompoundStmt 0x{{.+}} <col:53, col:55>
- // CHECK: FunctionDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-26]]:3, col:41> col:19 TestFunctionTemplate 'void (testFunctionTemplateDecl::B)'
+ // CHECK: FunctionDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-32]]:3, col:41> col:19 TestFunctionTemplate 'void (testFunctionTemplateDecl::B)'
// CHECK-NEXT: |-TemplateArgument type 'testFunctionTemplateDecl::B'
+ // CHECK-NEXT: | `-RecordType 0{{.+}} 'testFunctionTemplateDecl::B'
+ // CHECK-NEXT: | `-CXXRecord 0x{{.+}} 'B'
// CHECK-NEXT: `-ParmVarDecl 0x{{.+}} <col:40> col:41 'testFunctionTemplateDecl::B'
@@ -311,19 +319,21 @@ namespace testClassTemplateDecl {
// CHECK-NEXT: | | |-MoveAssignment
// CHECK-NEXT: | | `-Destructor non_trivial user_declared
// CHECK-NEXT: | |-TemplateArgument type 'testClassTemplateDecl::A'
+// CHECK-NEXT: | | `-RecordType 0{{.+}} 'testClassTemplateDecl::A'
+// CHECK-NEXT: | | `-CXXRecord 0x{{.+}} 'A'
// CHECK-NEXT: | |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <col:24, col:30> col:30 implicit class TestClassTemplate
-// CHECK-NEXT: | |-AccessSpecDecl 0x{{.+}} <line:[[@LINE-65]]:3, col:9> col:3 public
-// CHECK-NEXT: | |-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-65]]:5, col:23> col:5 used TestClassTemplate 'void ()'
-// CHECK-NEXT: | |-CXXDestructorDecl 0x{{.+}} <line:[[@LINE-65]]:5, col:24> col:5 used ~TestClassTemplate 'void () noexcept'
-// CHECK-NEXT: | |-CXXMethodDecl 0x{{.+}} <line:[[@LINE-65]]:5, col:11> col:9 j 'int ()'
-// CHECK-NEXT: | |-FieldDecl 0x{{.+}} <line:[[@LINE-65]]:5, col:9> col:9 i 'int'
-// CHECK-NEXT: | `-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-71]]:30> col:30 implicit constexpr TestClassTemplate 'void (const testClassTemplateDecl::TestClassTemplate<testClassTemplateDecl::A> &)' inline default trivial noexcept-unevaluated 0x{{.+}}
+// CHECK-NEXT: | |-AccessSpecDecl 0x{{.+}} <line:[[@LINE-67]]:3, col:9> col:3 public
+// CHECK-NEXT: | |-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-67]]:5, col:23> col:5 used TestClassTemplate 'void ()'
+// CHECK-NEXT: | |-CXXDestructorDecl 0x{{.+}} <line:[[@LINE-67]]:5, col:24> col:5 used ~TestClassTemplate 'void () noexcept'
+// CHECK-NEXT: | |-CXXMethodDecl 0x{{.+}} <line:[[@LINE-67]]:5, col:11> col:9 j 'int ()'
+// CHECK-NEXT: | |-FieldDecl 0x{{.+}} <line:[[@LINE-67]]:5, col:9> col:9 i 'int'
+// CHECK-NEXT: | `-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-73]]:30> col:30 implicit constexpr TestClassTemplate 'void (const testClassTemplateDecl::TestClassTemplate<testClassTemplateDecl::A> &)' inline default trivial noexcept-unevaluated 0x{{.+}}
// CHECK-NEXT: | `-ParmVarDecl 0x{{.+}} <col:30> col:30 'const testClassTemplateDecl::TestClassTemplate<testClassTemplateDecl::A> &'
// CHECK-NEXT: |-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate'
// CHECK-NEXT: |-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate'
// CHECK-NEXT: `-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate'
-// CHECK: ClassTemplateSpecializationDecl 0x{{.+}} <{{.+}}:[[@LINE-65]]:3, line:[[@LINE-63]]:3> line:[[@LINE-65]]:20 class TestClassTemplate definition
+// CHECK: ClassTemplateSpecializationDecl 0x{{.+}} <{{.+}}:[[@LINE-67]]:3, line:[[@LINE-65]]:3> line:[[@LINE-67]]:20 class TestClassTemplate definition
// CHECK-NEXT: |-DefinitionData pass_in_registers standard_layout trivially_copyable trivial literal
// CHECK-NEXT: | |-DefaultConstructor exists trivial needs_implicit
// CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
@@ -332,8 +342,10 @@ namespace testClassTemplateDecl {
// CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit
// CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit
// CHECK-NEXT: |-TemplateArgument type 'testClassTemplateDecl::B'
+// CHECK-NEXT: | `-RecordType 0{{.+}} 'testClassTemplateDecl::B'
+// CHECK-NEXT: | `-CXXRecord 0x{{.+}} 'B'
// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} <col:14, col:20> col:20 implicit class TestClassTemplate
-// CHECK-NEXT: `-FieldDecl 0x{{.+}} <line:[[@LINE-74]]:5, col:9> col:9 j 'int'
+// CHECK-NEXT: `-FieldDecl 0x{{.+}} <line:[[@LINE-78]]:5, col:9> col:9 j 'int'
// CHECK: ClassTemplateSpecializationDecl 0x{{.+}} <{{.+}}:{{.*}}:3, col:44> col:25 class TestClassTemplate definition
// CHECK-NEXT: |-DefinitionData standard_layout has_user_declared_ctor can_const_default_init
@@ -344,14 +356,16 @@ namespace testClassTemplateDecl {
// CHECK-NEXT: | |-MoveAssignment
// CHECK-NEXT: | `-Destructor non_trivial user_declared
// CHECK-NEXT: |-TemplateArgument type 'testClassTemplateDecl::C'
-// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <line:[[@LINE-98]]:24, col:30> col:30 implicit class TestClassTemplate
-// CHECK-NEXT: |-AccessSpecDecl 0x{{.+}} <line:[[@LINE-98]]:3, col:9> col:3 public
-// CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-98]]:5, col:23> col:5 TestClassTemplate 'void ()'
-// CHECK-NEXT: |-CXXDestructorDecl 0x{{.+}} <line:[[@LINE-98]]:5, col:24> col:5 ~TestClassTemplate 'void ()' noexcept-unevaluated 0x{{.+}}
-// CHECK-NEXT: |-CXXMethodDecl 0x{{.+}} <line:[[@LINE-98]]:5, col:11> col:9 j 'int ()'
-// CHECK-NEXT: `-FieldDecl 0x{{.+}} <line:[[@LINE-98]]:5, col:9> col:9 i 'int'
-
-// CHECK: ClassTemplateSpecializationDecl 0x{{.+}} <{{.+}}:[[@LINE-85]]:3, col:37> col:18 class TestClassTemplate definition
+// CHECK-NEXT: | `-RecordType 0{{.+}} 'testClassTemplateDecl::C'
+// CHECK-NEXT: | `-CXXRecord 0x{{.+}} 'C'
+// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <line:[[@LINE-104]]:24, col:30> col:30 implicit class TestClassTemplate
+// CHECK-NEXT: |-AccessSpecDecl 0x{{.+}} <line:[[@LINE-104]]:3, col:9> col:3 public
+// CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-104]]:5, col:23> col:5 TestClassTemplate 'void ()'
+// CHECK-NEXT: |-CXXDestructorDecl 0x{{.+}} <line:[[@LINE-104]]:5, col:24> col:5 ~TestClassTemplate 'void ()' noexcept-unevaluated 0x{{.+}}
+// CHECK-NEXT: |-CXXMethodDecl 0x{{.+}} <line:[[@LINE-104]]:5, col:11> col:9 j 'int ()'
+// CHECK-NEXT: `-FieldDecl 0x{{.+}} <line:[[@LINE-104]]:5, col:9> col:9 i 'int'
+
+// CHECK: ClassTemplateSpecializationDecl 0x{{.+}} <{{.+}}:[[@LINE-91]]:3, col:37> col:18 class TestClassTemplate definition
// CHECK-NEXT: |-DefinitionData standard_layout has_user_declared_ctor can_const_default_init
// CHECK-NEXT: | |-DefaultConstructor exists non_trivial user_provided
// CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
@@ -360,17 +374,19 @@ namespace testClassTemplateDecl {
// CHECK-NEXT: | |-MoveAssignment
// CHECK-NEXT: | `-Destructor non_trivial user_declared
// CHECK-NEXT: |-TemplateArgument type 'testClassTemplateDecl::D'
-// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <line:[[@LINE-114]]:24, col:30> col:30 implicit class TestClassTemplate
-// CHECK-NEXT: |-AccessSpecDecl 0x{{.+}} <line:[[@LINE-114]]:3, col:9> col:3 public
-// CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-114]]:5, col:23> col:5 TestClassTemplate 'void ()'
-// CHECK-NEXT: |-CXXDestructorDecl 0x{{.+}} <line:[[@LINE-114]]:5, col:24> col:5 ~TestClassTemplate 'void ()' noexcept-unevaluated 0x{{.+}}
-// CHECK-NEXT: |-CXXMethodDecl 0x{{.+}} <line:[[@LINE-114]]:5, col:11> col:9 j 'int ()'
-// CHECK-NEXT: `-FieldDecl 0x{{.+}} <line:[[@LINE-114]]:5, col:9> col:9 i 'int'
-
-// CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-98]]:3, line:[[@LINE-96]]:3> line:[[@LINE-98]]:44 TestClassTemplatePartial
+// CHECK-NEXT: | `-RecordType 0{{.+}} 'testClassTemplateDecl::D'
+// CHECK-NEXT: | `-CXXRecord 0x{{.+}} 'D'
+// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <line:[[@LINE-122]]:24, col:30> col:30 implicit class TestClassTemplate
+// CHECK-NEXT: |-AccessSpecDecl 0x{{.+}} <line:[[@LINE-122]]:3, col:9> col:3 public
+// CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-122]]:5, col:23> col:5 TestClassTemplate 'void ()'
+// CHECK-NEXT: |-CXXDestructorDecl 0x{{.+}} <line:[[@LINE-122]]:5, col:24> col:5 ~TestClassTemplate 'void ()' noexcept-unevaluated 0x{{.+}}
+// CHECK-NEXT: |-CXXMethodDecl 0x{{.+}} <line:[[@LINE-122]]:5, col:11> col:9 j 'int ()'
+// CHECK-NEXT: `-FieldDecl 0x{{.+}} <line:[[@LINE-122]]:5, col:9> col:9 i 'int'
+
+// CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-106]]:3, line:[[@LINE-104]]:3> line:[[@LINE-106]]:44 TestClassTemplatePartial
// CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T1
// CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:25, col:34> col:34 typename depth 0 index 1 T2
-// CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} <col:38, line:[[@LINE-99]]:3> line:[[@LINE-101]]:44 class TestClassTemplatePartial definition
+// CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} <col:38, line:[[@LINE-107]]:3> line:[[@LINE-109]]:44 class TestClassTemplatePartial definition
// CHECK-NEXT: |-DefinitionData standard_layout trivially_copyable trivial literal
// CHECK-NEXT: | |-DefaultConstructor exists trivial needs_implicit
// CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
@@ -379,9 +395,9 @@ namespace testClassTemplateDecl {
// CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit
// CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit
// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} <col:38, col:44> col:44 implicit class TestClassTemplatePartial
-// CHECK-NEXT: `-FieldDecl 0x{{.+}} <line:[[@LINE-109]]:5, col:9> col:9 i 'int'
+// CHECK-NEXT: `-FieldDecl 0x{{.+}} <line:[[@LINE-117]]:5, col:9> col:9 i 'int'
-// CHECK: ClassTemplatePartialSpecializationDecl 0x{{.+}} <{{.+}}:[[@LINE-109]]:3, line:[[@LINE-107]]:3> line:[[@LINE-109]]:31 class TestClassTemplatePartial definition
+// CHECK: ClassTemplatePartialSpecializationDecl 0x{{.+}} <{{.+}}:[[@LINE-117]]:3, line:[[@LINE-115]]:3> line:[[@LINE-117]]:31 class TestClassTemplatePartial definition
// CHECK-NEXT: |-DefinitionData standard_layout trivially_copyable trivial literal
// CHECK-NEXT: | |-DefaultConstructor exists trivial needs_implicit
// CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
@@ -390,20 +406,25 @@ namespace testClassTemplateDecl {
// CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit
// CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit
// CHECK-NEXT: |-TemplateArgument type 'type-parameter-0-0'
+// CHECK-NEXT: | `-TemplateTypeParmType 0x{{.+}} 'type-parameter-0-0' dependent depth 0 index 0
// CHECK-NEXT: |-TemplateArgument type 'testClassTemplateDecl::A'
+// CHECK-NEXT: | `-RecordType 0x{{.+}} 'testClassTemplateDecl::A'
+// CHECK-NEXT: | `-CXXRecord 0x{{.+}} 'A'
// CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 referenced typename depth 0 index 0 T1
// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} <col:25, col:31> col:31 implicit class TestClassTemplatePartial
-// CHECK-NEXT: `-FieldDecl 0x{{.+}} <line:[[@LINE-120]]:5, col:9> col:9 j 'int'
+// CHECK-NEXT: `-FieldDecl 0x{{.+}} <line:[[@LINE-131]]:5, col:9> col:9 j 'int'
-// CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-119]]:3, col:37> col:37 TestTemplateDefaultType
+// CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-130]]:3, col:37> col:37 TestTemplateDefaultType
// CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:25> col:21 typename depth 0 index 0 T
// CHECK-NEXT: | `-TemplateArgument type 'int'
+// CHECK-NEXT: | `-BuiltinType 0x{{.+}} 'int'
// CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} <col:30, col:37> col:37 struct TestTemplateDefaultType
-// CHECK: ClassTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-123]]:3, col:57> col:31 TestTemplateDefaultType
+// CHECK: ClassTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-135]]:3, col:57> col:31 TestTemplateDefaultType
// CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T
// CHECK-NEXT: | `-TemplateArgument type 'int'
-// CHECK-NEXT: | `-inherited from TemplateTypeParm 0x{{.+}} 'T'
+// CHECK-NEXT: | |-inherited from TemplateTypeParm 0x{{.+}} 'T'
+// CHECK-NEXT: | `-BuiltinType 0x{{.+}} 'int'
// CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <col:24, col:57> col:31 struct TestTemplateDefaultType definition
// CHECK-NEXT: |-DefinitionData empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
// CHECK-NEXT: | |-DefaultConstructor exists trivial constexpr needs_implicit defaulted_is_constexpr
@@ -414,7 +435,7 @@ namespace testClassTemplateDecl {
// CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit
// CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} <col:24, col:31> col:31 implicit struct TestTemplateDefaultType
-// CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-135]]:3, col:31> col:31 TestTemplateDefaultNonType
+// CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-148]]:3, col:31> col:31 TestTemplateDefaultNonType
// CHECK-NEXT: |-NonTypeTemplateParmDecl 0x{{.+}} <col:12, col:20> col:16 'int' depth 0 index 0 I
// CHECK-NEXT: | `-TemplateArgument expr
// CHECK-NEXT: | `-ConstantExpr 0x{{.+}} <col:20> 'int'
@@ -456,9 +477,11 @@ namespace testCanonicalTemplate {
// CHECK-NEXT: | `-ParmVarDecl 0x{{.*}} <col:50> col:51 'T'
// CHECK-NEXT: `-FunctionDecl 0x{{.*}} <line:[[@LINE-6]]:24, col:51> col:29 used TestFunctionTemplate 'void (testCanonicalTemplate::A)'
// CHECK-NEXT: |-TemplateArgument type 'testCanonicalTemplate::A'
+ // CHECK-NEXT: | `-RecordType 0x{{.+}} 'testCanonicalTemplate::A'
+ // CHECK-NEXT: | `-CXXRecord 0x{{.+}} 'A'
// CHECK-NEXT: `-ParmVarDecl 0x{{.*}} <col:50> col:51 'testCanonicalTemplate::A':'testCanonicalTemplate::A'
- // CHECK: FunctionTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-10]]:3, col:51> col:29 TestFunctionTemplate
+ // CHECK: FunctionTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-12]]:3, col:51> col:29 TestFunctionTemplate
// CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 referenced typename depth 0 index 0 T
// CHECK-NEXT: |-FunctionDecl{{.*}} 0x{{.+}} prev 0x{{.+}} <col:24, col:51> col:29 TestFunctionTemplate 'void (T)'
// CHECK-NEXT: | `-ParmVarDecl 0x{{.+}} <col:50> col:51 'T'
@@ -493,13 +516,15 @@ namespace testCanonicalTemplate {
// CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit
// CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit
// CHECK-NEXT: |-TemplateArgument type 'testCanonicalTemplate::A'
+ // CHECK-NEXT: | `-RecordType 0x{{.+}} 'testCanonicalTemplate::A'
+ // CHECK-NEXT: | `-CXXRecord 0x{{.+}} 'A'
// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <col:25, col:31> col:31 implicit class TestClassTemplate
- // CHECK-NEXT: |-FriendDecl 0x{{.+}} <line:[[@LINE-28]]:5, col:40> col:40
+ // CHECK-NEXT: |-FriendDecl 0x{{.+}} <line:[[@LINE-30]]:5, col:40> col:40
// CHECK-NEXT: | `-ClassTemplateDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <col:5, col:40> col:40 TestClassTemplate
// CHECK-NEXT: | |-TemplateTypeParmDecl 0x{{.+}} <col:14, col:23> col:23 typename depth 0 index 0 T2
// CHECK-NEXT: | |-CXXRecordDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <col:34, col:40> col:40 class TestClassTemplate
// CHECK-NEXT: | `-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate'
- // CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-34]]:31> col:31 implicit used constexpr TestClassTemplate 'void () noexcept' inline default trivial
+ // CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-36]]:31> col:31 implicit used constexpr TestClassTemplate 'void () noexcept' inline default trivial
// CHECK-NEXT: | `-CompoundStmt 0x{{.+}} <col:31>
// CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} <col:31> col:31 implicit constexpr TestClassTemplate 'void (const testCanonicalTemplate::TestClassTemplate<testCanonicalTemplate::A> &)' inline default trivial noexcept-unevaluated 0x{{.+}}
// CHECK-NEXT: | `-ParmVarDecl 0x{{.+}} <col:31> col:31 'const testCanonicalTemplate::TestClassTemplate<testCanonicalTemplate::A> &'
@@ -524,6 +549,8 @@ namespace testCanonicalTemplate {
// CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit
// CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit
// CHECK-NEXT: |-TemplateArgument type 'testCanonicalTemplate::A'
+ // CHECK-NEXT: | `-RecordType 0x{{.+}} 'testCanonicalTemplate::A'
+ // CHECK-NEXT: | `-CXXRecord 0x{{.+}} 'A'
// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <col:25, col:31> col:31 implicit class TestClassTemplate2
// CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} <col:31> col:31 implicit used constexpr TestClassTemplate2 'void () noexcept' inline default trivial
// CHECK-NEXT: | `-CompoundStmt 0x{{.+}} <col:31>
@@ -532,14 +559,14 @@ namespace testCanonicalTemplate {
// CHECK-NEXT: `-CXXConstructorDecl 0x{{.+}} <col:31> col:31 implicit constexpr TestClassTemplate2 'void (testCanonicalTemplate::TestClassTemplate2<testCanonicalTemplate::A> &&)' inline default trivial noexcept-unevaluated 0x{{.+}}
// CHECK-NEXT: `-ParmVarDecl 0x{{.+}} <col:31> col:31 'testCanonicalTemplate::TestClassTemplate2<testCanonicalTemplate::A> &&'
- // CHECK: ClassTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-24]]:3, col:31> col:31 TestClassTemplate2
+ // CHECK: ClassTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-26]]:3, col:31> col:31 TestClassTemplate2
// CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T1
// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <col:25, col:31> col:31 class TestClassTemplate2
// CHECK-NEXT: `-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate2'
- // CHECK: ClassTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-28]]:3, line:[[@LINE-27]]:3> line:[[@LINE-28]]:31 TestClassTemplate2
+ // CHECK: ClassTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-30]]:3, line:[[@LINE-29]]:3> line:[[@LINE-30]]:31 TestClassTemplate2
// CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T1
- // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <col:25, line:[[@LINE-29]]:3> line:[[@LINE-30]]:31 class TestClassTemplate2 definition
+ // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <col:25, line:[[@LINE-31]]:3> line:[[@LINE-32]]:31 class TestClassTemplate2 definition
// CHECK-NEXT: | |-DefinitionData empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
// CHECK-NEXT: | | |-DefaultConstructor exists trivial constexpr needs_implicit defaulted_is_constexpr
// CHECK-NEXT: | | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
@@ -567,22 +594,25 @@ namespace testCanonicalTemplate {
// CHECK-NEXT: |-VarDecl 0x{{.+}} <col:28, col:43> col:43 TestVarTemplate 'const T' static
// CHECK-NEXT: |-VarTemplateSpecializationDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <line:[[@LINE-11]]:3, col:34> col:14 referenced TestVarTemplate 'const int':'const int' cinit
// CHECK-NEXT: | |-TemplateArgument type 'int'
+ // CHECK-NEXT: | | `-BuiltinType 0x{{.+}} 'int'
// CHECK-NEXT: | `-InitListExpr 0x{{.+}} <col:32, col:34> 'int':'int'
- // CHECK-NEXT: `-VarTemplateSpecializationDecl 0x{{.+}} <line:[[@LINE-17]]:28, col:43> col:43 referenced TestVarTemplate 'const int':'const int' static
+ // CHECK-NEXT: `-VarTemplateSpecializationDecl 0x{{.+}} <line:[[@LINE-18]]:28, col:43> col:43 referenced TestVarTemplate 'const int':'const int' static
// CHECK-NEXT: `-TemplateArgument type 'int'
- // CHECK: VarTemplateSpecializationDecl 0x{{.+}} <{{.+}}:[[@LINE-20]]:28, col:43> col:43 referenced TestVarTemplate 'const int':'const int' static
+ // CHECK: VarTemplateSpecializationDecl 0x{{.+}} <{{.+}}:[[@LINE-21]]:28, col:43> col:43 referenced TestVarTemplate 'const int':'const int' static
// CHECK-NEXT:`-TemplateArgument type 'int'
+ // CHECK-NEXT: `-BuiltinType 0x{{.+}} 'int'
- // CHECK: VarTemplateDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-21]]:3, line:[[@LINE-20]]:34> col:14 TestVarTemplate
- // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <line:[[@LINE-22]]:12, col:21> col:21 referenced typename depth 0 index 0 T
- // CHECK-NEXT: |-VarDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <line:[[@LINE-22]]:3, col:34> col:14 TestVarTemplate 'const T' cinit
+ // CHECK: VarTemplateDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-23]]:3, line:[[@LINE-22]]:34> col:14 TestVarTemplate
+ // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <line:[[@LINE-24]]:12, col:21> col:21 referenced typename depth 0 index 0 T
+ // CHECK-NEXT: |-VarDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <line:[[@LINE-24]]:3, col:34> col:14 TestVarTemplate 'const T' cinit
// CHECK-NEXT: | `-InitListExpr 0x{{.+}} <col:32, col:34> 'void'
// CHECK-NEXT: |-VarTemplateSpecialization 0x{{.+}} 'TestVarTemplate' 'const int':'const int'
// CHECK-NEXT: `-VarTemplateSpecialization 0x{{.+}} 'TestVarTemplate' 'const int':'const int'
- // CHECK: VarTemplateSpecializationDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-27]]:3, col:34> col:14 referenced TestVarTemplate 'const int':'const int' cinit
+ // CHECK: VarTemplateSpecializationDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-29]]:3, col:34> col:14 referenced TestVarTemplate 'const int':'const int' cinit
// CHECK-NEXT: |-TemplateArgument type 'int'
+ // CHECK-NEXT: | `-BuiltinType 0x{{.+}} 'int'
// CHECK-NEXT: `-InitListExpr 0x{{.+}} <col:32, col:34> 'int':'int'
}
diff --git a/clang/test/AST/ast-dump-openmp-begin-declare-variant_template_1.cpp b/clang/test/AST/ast-dump-openmp-begin-declare-variant_template_1.cpp
index 6a663d5d75d9..6d36c1b90eb8 100644
--- a/clang/test/AST/ast-dump-openmp-begin-declare-variant_template_1.cpp
+++ b/clang/test/AST/ast-dump-openmp-begin-declare-variant_template_1.cpp
@@ -118,7 +118,7 @@ int test() {
// CHECK-NEXT: | | `-IntegerLiteral [[ADDR_58:0x[a-z0-9]*]] <col:23> 'int' 0
// CHECK-NEXT: | `-FunctionDecl [[ADDR_59:0x[a-z0-9]*]] <line:37:1, line:40:1> line:37:5 used test1 'int ({{.*}})'
// CHECK-NEXT: | |-TemplateArgument type 'double'
-// CHECK-NEXT: | `-CompoundStmt [[ADDR_60:0x[a-z0-9]*]] <col:13, line:40:1>
+// CHECK: | `-CompoundStmt [[ADDR_60:0x[a-z0-9]*]] <col:13, line:40:1>
// CHECK-NEXT: | `-ReturnStmt [[ADDR_61:0x[a-z0-9]*]] <line:39:3, col:25>
// CHECK-NEXT: | `-PseudoObjectExpr [[ADDR_62:0x[a-z0-9]*]] <col:10, col:25> 'int'
// CHECK-NEXT: | |-CallExpr [[ADDR_63:0x[a-z0-9]*]] <col:10, col:25> 'int'
diff --git a/clang/test/AST/ast-dump-template-decls-json.cpp b/clang/test/AST/ast-dump-template-decls-json.cpp
index 658358c5789e..f074d6f0137d 100644
--- a/clang/test/AST/ast-dump-template-decls-json.cpp
+++ b/clang/test/AST/ast-dump-template-decls-json.cpp
@@ -597,13 +597,31 @@ void V<Ty>::f() {}
// CHECK-NEXT: "kind": "TemplateArgument",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "float"
-// CHECK-NEXT: }
+// CHECK-NEXT: },
+// CHECK-NEXT: "inner": [
+// CHECK-NEXT: {
+// CHECK-NEXT: "id": "0x{{.*}}",
+// CHECK-NEXT: "kind": "BuiltinType",
+// CHECK-NEXT: "type": {
+// CHECK-NEXT: "qualType": "float"
+// CHECK-NEXT: }
+// CHECK-NEXT: }
+// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "kind": "TemplateArgument",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "int"
-// CHECK-NEXT: }
+// CHECK-NEXT: },
+// CHECK-NEXT: "inner": [
+// CHECK-NEXT: {
+// CHECK-NEXT: "id": "0x{{.*}}",
+// CHECK-NEXT: "kind": "BuiltinType",
+// CHECK-NEXT: "type": {
+// CHECK-NEXT: "qualType": "int"
+// CHECK-NEXT: }
+// CHECK-NEXT: }
+// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
@@ -1120,7 +1138,16 @@ void V<Ty>::f() {}
// CHECK-NEXT: "kind": "TemplateArgument",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "int"
-// CHECK-NEXT: }
+// CHECK-NEXT: },
+// CHECK-NEXT: "inner": [
+// CHECK-NEXT: {
+// CHECK-NEXT: "id": "0x{{.*}}",
+// CHECK-NEXT: "kind": "BuiltinType",
+// CHECK-NEXT: "type": {
+// CHECK-NEXT: "qualType": "int"
+// CHECK-NEXT: }
+// CHECK-NEXT: }
+// CHECK-NEXT: ]
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: },
@@ -1238,7 +1265,16 @@ void V<Ty>::f() {}
// CHECK-NEXT: "kind": "TemplateArgument",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "void"
-// CHECK-NEXT: }
+// CHECK-NEXT: },
+// CHECK-NEXT: "inner": [
+// CHECK-NEXT: {
+// CHECK-NEXT: "id": "0x{{.*}}",
+// CHECK-NEXT: "kind": "BuiltinType",
+// CHECK-NEXT: "type": {
+// CHECK-NEXT: "qualType": "void"
+// CHECK-NEXT: }
+// CHECK-NEXT: }
+// CHECK-NEXT: ]
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: },
@@ -1511,7 +1547,16 @@ void V<Ty>::f() {}
// CHECK-NEXT: "kind": "TemplateArgument",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "int"
-// CHECK-NEXT: }
+// CHECK-NEXT: },
+// CHECK-NEXT: "inner": [
+// CHECK-NEXT: {
+// CHECK-NEXT: "id": "0x{{.*}}",
+// CHECK-NEXT: "kind": "BuiltinType",
+// CHECK-NEXT: "type": {
+// CHECK-NEXT: "qualType": "int"
+// CHECK-NEXT: }
+// CHECK-NEXT: }
+// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
@@ -1799,13 +1844,38 @@ void V<Ty>::f() {}
// CHECK-NEXT: "kind": "TemplateArgument",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "type-parameter-0-0"
-// CHECK-NEXT: }
+// CHECK-NEXT: },
+// CHECK-NEXT: "inner": [
+// CHECK-NEXT: {
+// CHECK-NEXT: "id": "0x{{.*}}",
+// CHECK-NEXT: "kind": "TemplateTypeParmType",
+// CHECK-NEXT: "type": {
+// CHECK-NEXT: "qualType": "type-parameter-0-0"
+// CHECK-NEXT: },
+// CHECK-NEXT: "isDependent": true,
+// CHECK-NEXT: "isInstantiationDependent": true,
+// CHECK-NEXT: "depth": 0,
+// CHECK-NEXT: "index": 0,
+// CHECK-NEXT: "decl": {
+// CHECK-NEXT: "id": "0x0"
+// CHECK-NEXT: }
+// CHECK-NEXT: }
+// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "kind": "TemplateArgument",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "int"
-// CHECK-NEXT: }
+// CHECK-NEXT: },
+// CHECK-NEXT: "inner": [
+// CHECK-NEXT: {
+// CHECK-NEXT: "id": "0x{{.*}}",
+// CHECK-NEXT: "kind": "BuiltinType",
+// CHECK-NEXT: "type": {
+// CHECK-NEXT: "qualType": "int"
+// CHECK-NEXT: }
+// CHECK-NEXT: }
+// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
diff --git a/clang/test/AST/ast-dump-template-decls.cpp b/clang/test/AST/ast-dump-template-decls.cpp
index 29d2335ce015..e58731ae6d51 100644
--- a/clang/test/AST/ast-dump-template-decls.cpp
+++ b/clang/test/AST/ast-dump-template-decls.cpp
@@ -79,8 +79,8 @@ struct S {};
template <typename Ty>
// CHECK: ClassTemplatePartialSpecializationDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+4]]:20> col:8 struct S definition
// CHECK: TemplateArgument type 'type-parameter-0-0'
-// CHECK-NEXT: TemplateArgument type 'int'
-// CHECK-NEXT: TemplateTypeParmDecl 0x{{[^ ]*}} <line:[[@LINE-4]]:11, col:20> col:20 referenced typename depth 0 index 0 Ty
+// CHECK: TemplateArgument type 'int'
+// CHECK: TemplateTypeParmDecl 0x{{[^ ]*}} <line:[[@LINE-4]]:11, col:20> col:20 referenced typename depth 0 index 0 Ty
struct S<Ty, int> {};
template <auto>
diff --git a/clang/test/AST/float16.cpp b/clang/test/AST/float16.cpp
index c886aa9cf0f1..807289ac0a7f 100644
--- a/clang/test/AST/float16.cpp
+++ b/clang/test/AST/float16.cpp
@@ -178,7 +178,7 @@ template <class C> C func1t(C arg) {
//CHECK-NEXT: | | `-FloatingLiteral {{.*}} '_Float16' 2.000000e+00
//CHECK-NEXT: | `-FunctionDecl {{.*}} used func1t '_Float16 (_Float16)'
//CHECK-NEXT: | |-TemplateArgument type '_Float16'
-//CHECK-NEXT: | |-ParmVarDecl {{.*}} used arg '_Float16':'_Float16'
+//CHECK: | |-ParmVarDecl {{.*}} used arg '_Float16':'_Float16'
//CHECK-NEXT: | `-CompoundStmt
//CHECK-NEXT: | `-ReturnStmt
//CHECK-NEXT: | `-BinaryOperator {{.*}} '_Float16' '*'
diff --git a/clang/unittests/AST/ASTTraverserTest.cpp b/clang/unittests/AST/ASTTraverserTest.cpp
index 5585238939fe..6d3d83318032 100644
--- a/clang/unittests/AST/ASTTraverserTest.cpp
+++ b/clang/unittests/AST/ASTTraverserTest.cpp
@@ -244,6 +244,7 @@ FullComment
verifyWithDynNode(TA,
R"cpp(
TemplateArgument
+`-BuiltinType
)cpp");
Func = getFunctionNode(AST.get(), "parmvardecl_attr");
More information about the cfe-commits
mailing list