Index: cfe/trunk/test/AST/ast-dump-decl.cpp =================================================================== --- cfe/trunk/test/AST/ast-dump-decl.cpp +++ cfe/trunk/test/AST/ast-dump-decl.cpp @@ -207,26 +207,28 @@ // explicit instantiation definition template void TestFunctionTemplate(D); } -// CHECK: FunctionTemplateDecl{{.*}} TestFunctionTemplate -// CHECK-NEXT: TemplateTypeParmDecl -// CHECK-NEXT: FunctionDecl{{.*}} TestFunctionTemplate 'void (T)' -// CHECK-NEXT: ParmVarDecl{{.*}} 'T' -// CHECK-NEXT: CompoundStmt -// CHECK-NEXT: FunctionDecl{{.*}} TestFunctionTemplate {{.*}}A -// CHECK-NEXT: TemplateArgument -// CHECK-NEXT: ParmVarDecl -// CHECK-NEXT: CompoundStmt -// CHECK-NEXT: Function{{.*}} 'TestFunctionTemplate' {{.*}}B -// CHECK-NEXT: FunctionDecl{{.*}} TestFunctionTemplate {{.*}}C -// CHECK-NEXT: TemplateArgument -// CHECK-NEXT: ParmVarDecl -// CHECK-NEXT: FunctionDecl{{.*}} TestFunctionTemplate {{.*}}D -// CHECK-NEXT: TemplateArgument -// CHECK-NEXT: ParmVarDecl -// CHECK-NEXT: CompoundStmt -// CHECK: FunctionDecl{{.*}} TestFunctionTemplate {{.*}}B -// CHECK-NEXT: TemplateArgument -// CHECK-NEXT: ParmVarDecl + // CHECK: FunctionTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-14]]:3, col:55> col:29 TestFunctionTemplate + // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} col:21 referenced typename depth 0 index 0 T + // CHECK-NEXT: |-FunctionDecl 0x{{.+}} col:29 TestFunctionTemplate 'void (T)' + // CHECK-NEXT: | |-ParmVarDecl 0x{{.+}} col:51 'T' + // CHECK-NEXT: | `-CompoundStmt 0x{{.+}} + // CHECK-NEXT: |-FunctionDecl 0x{{.+}} col:29 used TestFunctionTemplate 'void (testFunctionTemplateDecl::A)' + // CHECK-NEXT: | |-TemplateArgument type 'testFunctionTemplateDecl::A' + // CHECK-NEXT: | |-ParmVarDecl 0x{{.+}} col:51 'testFunctionTemplateDecl::A':'testFunctionTemplateDecl::A' + // CHECK-NEXT: | `-CompoundStmt 0x{{.+}} + // CHECK-NEXT: |-Function 0x{{.+}} 'TestFunctionTemplate' 'void (testFunctionTemplateDecl::B)' + // CHECK-NEXT: |-FunctionDecl 0x{{.+}} col:29 TestFunctionTemplate 'void (testFunctionTemplateDecl::C)' + // CHECK-NEXT: | |-TemplateArgument type 'testFunctionTemplateDecl::C' + // CHECK-NEXT: | `-ParmVarDecl 0x{{.+}} col:51 'testFunctionTemplateDecl::C':'testFunctionTemplateDecl::C' + // CHECK-NEXT: `-FunctionDecl 0x{{.+}} col:29 TestFunctionTemplate 'void (testFunctionTemplateDecl::D)' + // CHECK-NEXT: |-TemplateArgument type 'testFunctionTemplateDecl::D' + // CHECK-NEXT: |-ParmVarDecl 0x{{.+}} col:51 'testFunctionTemplateDecl::D':'testFunctionTemplateDecl::D' + // CHECK-NEXT: `-CompoundStmt 0x{{.+}} + + // CHECK: FunctionDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-26]]:3, col:41> col:19 TestFunctionTemplate 'void (testFunctionTemplateDecl::B)' + // CHECK-NEXT: |-TemplateArgument type 'testFunctionTemplateDecl::B' + // CHECK-NEXT: `-ParmVarDecl 0x{{.+}} col:41 'testFunctionTemplateDecl::B' + namespace testClassTemplateDecl { class A { }; @@ -273,75 +275,163 @@ template class TT = TestClassTemplate> struct TestTemplateTemplateDefaultType; template class TT> struct TestTemplateTemplateDefaultType { }; } -// CHECK: ClassTemplateDecl{{.*}} TestClassTemplate -// CHECK-NEXT: TemplateTypeParmDecl -// CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate -// CHECK: CXXRecordDecl{{.*}} class TestClassTemplate -// CHECK-NEXT: AccessSpecDecl{{.*}} public -// CHECK-NEXT: CXXConstructorDecl{{.*}} -// CHECK-NEXT: CXXDestructorDecl{{.*}} -// CHECK-NEXT: CXXMethodDecl{{.*}} -// CHECK-NEXT: FieldDecl{{.*}} i -// CHECK-NEXT: ClassTemplateSpecializationDecl{{.*}} class TestClassTemplate -// CHECK: TemplateArgument{{.*}}A -// CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate -// CHECK-NEXT: AccessSpecDecl{{.*}} public -// CHECK-NEXT: CXXConstructorDecl{{.*}} -// CHECK-NEXT: CXXDestructorDecl{{.*}} -// CHECK-NEXT: CXXMethodDecl{{.*}} -// CHECK-NEXT: FieldDecl{{.*}} i -// CHECK: ClassTemplateSpecialization{{.*}} 'TestClassTemplate' -// CHECK-NEXT: ClassTemplateSpecialization{{.*}} 'TestClassTemplate' -// CHECK-NEXT: ClassTemplateSpecialization{{.*}} 'TestClassTemplate' - -// CHECK: ClassTemplateSpecializationDecl{{.*}} class TestClassTemplate -// CHECK-NEXT: DefinitionData -// CHECK: TemplateArgument{{.*}}B -// CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate -// CHECK-NEXT: FieldDecl{{.*}} j - -// CHECK: ClassTemplateSpecializationDecl{{.*}} class TestClassTemplate -// CHECK: TemplateArgument{{.*}}C -// CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate -// CHECK-NEXT: AccessSpecDecl{{.*}} public -// CHECK-NEXT: CXXConstructorDecl{{.*}} -// CHECK-NEXT: CXXDestructorDecl{{.*}} -// CHECK-NEXT: CXXMethodDecl{{.*}} -// CHECK-NEXT: FieldDecl{{.*}} i - -// CHECK: ClassTemplateSpecializationDecl{{.*}} class TestClassTemplate -// CHECK: TemplateArgument{{.*}}D -// CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate -// CHECK-NEXT: AccessSpecDecl{{.*}} public -// CHECK-NEXT: CXXConstructorDecl{{.*}} -// CHECK-NEXT: CXXDestructorDecl{{.*}} -// CHECK-NEXT: CXXMethodDecl{{.*}} -// CHECK-NEXT: FieldDecl{{.*}} i - -// CHECK: ClassTemplatePartialSpecializationDecl{{.*}} class TestClassTemplatePartial -// CHECK: TemplateArgument -// CHECK-NEXT: TemplateArgument{{.*}}A -// CHECK-NEXT: TemplateTypeParmDecl -// CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplatePartial -// CHECK-NEXT: FieldDecl{{.*}} j -// CHECK: ClassTemplateDecl 0x{{[^ ]*}} prev 0x{{[^ ]*}} {{.*}} TestTemplateDefaultType -// CHECK-NEXT: TemplateTypeParmDecl -// CHECK-NEXT: TemplateArgument type 'int' -// CHECK-NEXT: inherited from TemplateTypeParm 0x{{[^ ]*}} 'T' +// CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-40]]:3, line:[[@LINE-34]]:3> line:[[@LINE-40]]:30 TestClassTemplate +// CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} col:21 typename depth 0 index 0 T +// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} line:[[@LINE-42]]:30 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 +// CHECK-NEXT: | | |-MoveConstructor +// CHECK-NEXT: | | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param +// CHECK-NEXT: | | |-MoveAssignment +// CHECK-NEXT: | | `-Destructor non_trivial user_declared +// CHECK-NEXT: | |-CXXRecordDecl 0x{{.+}} col:30 implicit referenced class TestClassTemplate +// CHECK-NEXT: | |-AccessSpecDecl 0x{{.+}} col:3 public +// CHECK-NEXT: | |-CXXConstructorDecl 0x{{.+}} col:5 TestClassTemplate 'void ()' +// CHECK-NEXT: | |-CXXDestructorDecl 0x{{.+}} col:5 ~TestClassTemplate 'void ()' +// CHECK-NEXT: | |-CXXMethodDecl 0x{{.+}} col:9 j 'int ()' +// CHECK-NEXT: | `-FieldDecl 0x{{.+}} col:9 i 'int' +// CHECK-NEXT: |-ClassTemplateSpecializationDecl 0x{{.+}} line:[[@LINE-56]]:30 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 implicit_has_const_param +// CHECK-NEXT: | | |-MoveConstructor +// CHECK-NEXT: | | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param +// CHECK-NEXT: | | |-MoveAssignment +// CHECK-NEXT: | | `-Destructor non_trivial user_declared +// CHECK-NEXT: | |-TemplateArgument type 'testClassTemplateDecl::A' +// CHECK-NEXT: | |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} col:30 implicit class TestClassTemplate +// CHECK-NEXT: | |-AccessSpecDecl 0x{{.+}} col:3 public +// CHECK-NEXT: | |-CXXConstructorDecl 0x{{.+}} col:5 used TestClassTemplate 'void ()' +// CHECK-NEXT: | |-CXXDestructorDecl 0x{{.+}} col:5 used ~TestClassTemplate 'void () noexcept' +// CHECK-NEXT: | |-CXXMethodDecl 0x{{.+}} col:9 j 'int ()' +// CHECK-NEXT: | |-FieldDecl 0x{{.+}} col:9 i 'int' +// CHECK-NEXT: | `-CXXConstructorDecl 0x{{.+}} col:30 implicit constexpr TestClassTemplate 'void (const testClassTemplateDecl::TestClassTemplate &)' inline default trivial noexcept-unevaluated 0x{{.+}} +// CHECK-NEXT: | `-ParmVarDecl 0x{{.+}} col:30 'const testClassTemplateDecl::TestClassTemplate &' +// 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-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 +// CHECK-NEXT: | |-MoveConstructor exists simple trivial needs_implicit +// CHECK-NEXT: | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param +// CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit +// CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit +// CHECK-NEXT: |-TemplateArgument type 'testClassTemplateDecl::B' +// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} col:20 implicit class TestClassTemplate +// CHECK-NEXT: `-FieldDecl 0x{{.+}} col:9 j 'int' + +// CHECK: ClassTemplateSpecializationDecl 0x{{.+}} <{{.+}}:256:3, col:44> col:25 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 +// CHECK-NEXT: | |-MoveConstructor +// CHECK-NEXT: | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param +// CHECK-NEXT: | |-MoveAssignment +// CHECK-NEXT: | `-Destructor non_trivial user_declared +// CHECK-NEXT: |-TemplateArgument type 'testClassTemplateDecl::C' +// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} col:30 implicit class TestClassTemplate +// CHECK-NEXT: |-AccessSpecDecl 0x{{.+}} col:3 public +// CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} col:5 TestClassTemplate 'void ()' +// CHECK-NEXT: |-CXXDestructorDecl 0x{{.+}} col:5 ~TestClassTemplate 'void ()' noexcept-unevaluated 0x{{.+}} +// CHECK-NEXT: |-CXXMethodDecl 0x{{.+}} col:9 j 'int ()' +// CHECK-NEXT: `-FieldDecl 0x{{.+}} col:9 i 'int' + +// CHECK: ClassTemplateSpecializationDecl 0x{{.+}} <{{.+}}:[[@LINE-85]]: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 +// CHECK-NEXT: | |-MoveConstructor +// CHECK-NEXT: | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param +// CHECK-NEXT: | |-MoveAssignment +// CHECK-NEXT: | `-Destructor non_trivial user_declared +// CHECK-NEXT: |-TemplateArgument type 'testClassTemplateDecl::D' +// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} col:30 implicit class TestClassTemplate +// CHECK-NEXT: |-AccessSpecDecl 0x{{.+}} col:3 public +// CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} col:5 TestClassTemplate 'void ()' +// CHECK-NEXT: |-CXXDestructorDecl 0x{{.+}} col:5 ~TestClassTemplate 'void ()' noexcept-unevaluated 0x{{.+}} +// CHECK-NEXT: |-CXXMethodDecl 0x{{.+}} col:9 j 'int ()' +// CHECK-NEXT: `-FieldDecl 0x{{.+}} col:9 i 'int' + +// CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-98]]:3, line:[[@LINE-96]]:3> line:[[@LINE-98]]:44 TestClassTemplatePartial +// CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} col:21 typename depth 0 index 0 T1 +// CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} col:34 typename depth 0 index 1 T2 +// CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} line:[[@LINE-101]]: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 +// CHECK-NEXT: | |-MoveConstructor exists simple trivial needs_implicit +// CHECK-NEXT: | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param +// CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit +// CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit +// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} col:44 implicit class TestClassTemplatePartial +// CHECK-NEXT: `-FieldDecl 0x{{.+}} col:9 i 'int' + +// CHECK: ClassTemplatePartialSpecializationDecl 0x{{.+}} <{{.+}}:[[@LINE-109]]:3, line:[[@LINE-107]]:3> line:[[@LINE-109]]: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 +// CHECK-NEXT: | |-MoveConstructor exists simple trivial needs_implicit +// CHECK-NEXT: | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param +// 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: |-TemplateArgument type 'testClassTemplateDecl::A' +// CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} col:21 referenced typename depth 0 index 0 T1 +// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} col:31 implicit class TestClassTemplatePartial +// CHECK-NEXT: `-FieldDecl 0x{{.+}} col:9 j 'int' + +// CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-119]]:3, col:37> col:37 TestTemplateDefaultType +// CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} col:21 typename depth 0 index 0 T +// CHECK-NEXT: | `-TemplateArgument type 'int' +// CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} col:37 struct TestTemplateDefaultType + +// CHECK: ClassTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-123]]:3, col:57> col:31 TestTemplateDefaultType +// CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} col:21 typename depth 0 index 0 T +// CHECK-NEXT: | `-TemplateArgument type 'int' +// CHECK-NEXT: | `-inherited from TemplateTypeParm 0x{{.+}} 'T' +// CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} 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 +// CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param +// CHECK-NEXT: | |-MoveConstructor exists simple trivial needs_implicit +// CHECK-NEXT: | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param +// CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit +// CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit +// CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} col:31 implicit struct TestTemplateDefaultType + +// CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-135]]:3, col:31> col:31 TestTemplateDefaultNonType +// CHECK-NEXT: |-NonTypeTemplateParmDecl 0x{{.+}} col:16 'int' depth 0 index 0 I +// CHECK-NEXT: | `-TemplateArgument expr +// CHECK-NEXT: | `-ConstantExpr 0x{{.+}} 'int' +// CHECK-NEXT: | `-IntegerLiteral 0x{{.+}} 'int' 42 +// CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} col:31 struct TestTemplateDefaultNonType + +// CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:275:3, col:68> col:68 TestTemplateTemplateDefaultType +// CHECK-NEXT: |-TemplateTemplateParmDecl 0x{{.+}} col:37 depth 0 index 0 TT +// CHECK-NEXT: | |-TemplateTypeParmDecl 0x{{.+}} col:21 typename depth 1 index 0 +// CHECK-NEXT: | `-TemplateArgument template TestClassTemplate +// CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} col:68 struct TestTemplateTemplateDefaultType + +// CHECK: ClassTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:276:3, col:82> col:48 TestTemplateTemplateDefaultType +// CHECK-NEXT: |-TemplateTemplateParmDecl 0x{{.+}} col:37 depth 0 index 0 TT +// CHECK-NEXT: | |-TemplateTypeParmDecl 0x{{.+}} col:21 typename depth 1 index 0 +// CHECK-NEXT: | `-TemplateArgument template TestClassTemplate +// CHECK-NEXT: | `-inherited from TemplateTemplateParm 0x{{.+}} 'TT' +// CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} col:48 struct TestTemplateTemplateDefaultType 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 +// CHECK-NEXT: | |-MoveConstructor exists simple trivial needs_implicit +// CHECK-NEXT: | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param +// CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit +// CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit +// CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} col:48 implicit struct TestTemplateTemplateDefaultType -// CHECK: ClassTemplateDecl 0x{{[^ ]*}} prev 0x{{[^ ]*}} {{.*}} TestTemplateDefaultNonType -// CHECK-NEXT: NonTypeTemplateParmDecl -// CHECK-NEXT: TemplateArgument expr -// CHECK-NEXT: inherited from NonTypeTemplateParm 0x{{[^ ]*}} 'I' 'int' -// CHECK-NEXT: ConstantExpr -// CHECK-NEXT: IntegerLiteral - -// CHECK: ClassTemplateDecl 0x{{[^ ]*}} prev 0x{{[^ ]*}} {{.*}} TestTemplateTemplateDefaultType -// CHECK-NEXT: TemplateTemplateParmDecl -// CHECK-NEXT: TemplateTypeParmDecl -// CHECK-NEXT: TemplateArgument -// CHECK-NEXT: inherited from TemplateTemplateParm 0x{{[^ ]*}} 'TT' // PR15220 dump instantiation only once namespace testCanonicalTemplate { @@ -350,36 +440,141 @@ template void TestFunctionTemplate(T); template void TestFunctionTemplate(T); void bar(A a) { TestFunctionTemplate(a); } - // CHECK: FunctionTemplateDecl{{.*}} TestFunctionTemplate - // CHECK-NEXT: TemplateTypeParmDecl - // CHECK-NEXT: FunctionDecl{{.*}} TestFunctionTemplate 'void (T)' - // CHECK-NEXT: ParmVarDecl{{.*}} 'T' - // CHECK-NEXT: FunctionDecl{{.*}} TestFunctionTemplate {{.*}}A - // CHECK-NEXT: TemplateArgument - // CHECK-NEXT: ParmVarDecl - // CHECK: FunctionTemplateDecl{{.*}} TestFunctionTemplate - // CHECK-NEXT: TemplateTypeParmDecl - // CHECK-NEXT: FunctionDecl{{.*}} TestFunctionTemplate 'void (T)' - // CHECK-NEXT: ParmVarDecl{{.*}} 'T' - // CHECK-NEXT: Function{{.*}} 'TestFunctionTemplate' + // CHECK: FunctionTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-3]]:3, col:51> col:29 TestFunctionTemplate + // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} col:21 referenced typename depth 0 index 0 T + // CHECK-NEXT: |-FunctionDecl 0x{{.*}} col:29 TestFunctionTemplate 'void (T)' + // CHECK-NEXT: | `-ParmVarDecl 0x{{.*}} col:51 'T' + // CHECK-NEXT: `-FunctionDecl 0x{{.*}} col:29 used TestFunctionTemplate 'void (testCanonicalTemplate::A)' + // CHECK-NEXT: |-TemplateArgument type 'testCanonicalTemplate::A' + // CHECK-NEXT: `-ParmVarDecl 0x{{.*}} col:51 'testCanonicalTemplate::A':'testCanonicalTemplate::A' + + // CHECK: FunctionTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-10]]:3, col:51> col:29 TestFunctionTemplate + // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} col:21 referenced typename depth 0 index 0 T + // CHECK-NEXT: |-FunctionDecl{{.*}} 0x{{.+}} prev 0x{{.+}} col:29 TestFunctionTemplate 'void (T)' + // CHECK-NEXT: | `-ParmVarDecl 0x{{.+}} col:51 'T' + // CHECK-NEXT: `-Function 0x{{.+}} 'TestFunctionTemplate' 'void (testCanonicalTemplate::A)' // CHECK-NOT: TemplateArgument template class TestClassTemplate { template friend class TestClassTemplate; }; TestClassTemplate a; - // CHECK: ClassTemplateDecl{{.*}} TestClassTemplate - // CHECK-NEXT: TemplateTypeParmDecl - // CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate - // CHECK: CXXRecordDecl{{.*}} class TestClassTemplate - // CHECK-NEXT: FriendDecl - // CHECK-NEXT: ClassTemplateDecl{{.*}} TestClassTemplate - // CHECK-NEXT: TemplateTypeParmDecl - // CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate - // CHECK-NEXT: ClassTemplateSpecializationDecl{{.*}} class TestClassTemplate - // CHECK: TemplateArgument{{.*}}A - // CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate -} + // CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-4]]:3, line:[[@LINE-2]]:3> line:[[@LINE-4]]:31 TestClassTemplate + // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} col:21 typename depth 0 index 0 T1 + // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} line:[[@LINE-6]]:31 class TestClassTemplate 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 + // CHECK-NEXT: | | |-MoveConstructor exists simple trivial needs_implicit + // CHECK-NEXT: | | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param + // CHECK-NEXT: | | |-MoveAssignment exists simple trivial needs_implicit + // CHECK-NEXT: | | `-Destructor simple irrelevant trivial needs_implicit + // CHECK-NEXT: | |-CXXRecordDecl 0x{{.+}} col:31 implicit class TestClassTemplate + // CHECK-NEXT: | `-FriendDecl 0x{{.+}} col:40 + // CHECK-NEXT: | `-ClassTemplateDecl 0x{{.+}} parent 0x{{.+}} col:40 TestClassTemplate + // CHECK-NEXT: | |-TemplateTypeParmDecl 0x{{.+}} col:23 typename depth 1 index 0 T2 + // CHECK-NEXT: | `-CXXRecordDecl 0x{{.+}} parent 0x{{.+}} col:40 class TestClassTemplate + // CHECK-NEXT: `-ClassTemplateSpecializationDecl 0x{{.+}} line:[[@LINE-19]]:31 class TestClassTemplate definition + // CHECK-NEXT: |-DefinitionData pass_in_registers 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 defaulted_is_constexpr + // CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param implicit_has_const_param + // CHECK-NEXT: | |-MoveConstructor exists simple trivial + // CHECK-NEXT: | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param + // CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit + // CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit + // CHECK-NEXT: |-TemplateArgument type 'testCanonicalTemplate::A' + // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} col:31 implicit class TestClassTemplate + // CHECK-NEXT: |-FriendDecl 0x{{.+}} col:40 + // CHECK-NEXT: | `-ClassTemplateDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} col:40 TestClassTemplate + // CHECK-NEXT: | |-TemplateTypeParmDecl 0x{{.+}} col:23 typename depth 0 index 0 T2 + // CHECK-NEXT: | |-CXXRecordDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} col:40 class TestClassTemplate + // CHECK-NEXT: | `-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate' + // CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} col:31 implicit used constexpr TestClassTemplate 'void () noexcept' inline default trivial + // CHECK-NEXT: | `-CompoundStmt 0x{{.+}} + // CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} col:31 implicit constexpr TestClassTemplate 'void (const testCanonicalTemplate::TestClassTemplate &)' inline default trivial noexcept-unevaluated 0x{{.+}} + // CHECK-NEXT: | `-ParmVarDecl 0x{{.+}} col:31 'const testCanonicalTemplate::TestClassTemplate &' + // CHECK-NEXT: `-CXXConstructorDecl 0x{{.+}} col:31 implicit constexpr TestClassTemplate 'void (testCanonicalTemplate::TestClassTemplate &&)' inline default trivial noexcept-unevaluated 0x{{.+}} + // CHECK-NEXT: `-ParmVarDecl 0x{{.+}} col:31 'testCanonicalTemplate::TestClassTemplate &&' + + + template class TestClassTemplate2; + template class TestClassTemplate2; + template class TestClassTemplate2 { + }; + TestClassTemplate2 a2; + // CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-5]]:3, col:31> col:31 TestClassTemplate2 + // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} col:21 typename depth 0 index 0 T1 + // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} col:31 class TestClassTemplate2 + // CHECK-NEXT: `-ClassTemplateSpecializationDecl 0x{{.+}} line:[[@LINE-6]]:31 class TestClassTemplate2 definition + // CHECK-NEXT: |-DefinitionData pass_in_registers 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 defaulted_is_constexpr + // CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param implicit_has_const_param + // CHECK-NEXT: | |-MoveConstructor exists simple trivial + // CHECK-NEXT: | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param + // CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit + // CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit + // CHECK-NEXT: |-TemplateArgument type 'testCanonicalTemplate::A' + // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} col:31 implicit class TestClassTemplate2 + // CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} col:31 implicit used constexpr TestClassTemplate2 'void () noexcept' inline default trivial + // CHECK-NEXT: | `-CompoundStmt 0x{{.+}} + // CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} col:31 implicit constexpr TestClassTemplate2 'void (const testCanonicalTemplate::TestClassTemplate2 &)' inline default trivial noexcept-unevaluated 0x{{.+}} + // CHECK-NEXT: | `-ParmVarDecl 0x{{.+}} col:31 'const testCanonicalTemplate::TestClassTemplate2 &' + // CHECK-NEXT: `-CXXConstructorDecl 0x{{.+}} col:31 implicit constexpr TestClassTemplate2 'void (testCanonicalTemplate::TestClassTemplate2 &&)' inline default trivial noexcept-unevaluated 0x{{.+}} + // CHECK-NEXT: `-ParmVarDecl 0x{{.+}} col:31 'testCanonicalTemplate::TestClassTemplate2 &&' + + // CHECK: ClassTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-24]]:3, col:31> col:31 TestClassTemplate2 + // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} col:21 typename depth 0 index 0 T1 + // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} 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-NEXT: |-TemplateTypeParmDecl 0x{{.+}} col:21 typename depth 0 index 0 T1 + // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} line:[[@LINE-30]]: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 + // CHECK-NEXT: | | |-MoveConstructor exists simple trivial needs_implicit + // CHECK-NEXT: | | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param + // CHECK-NEXT: | | |-MoveAssignment exists simple trivial needs_implicit + // CHECK-NEXT: | | `-Destructor simple irrelevant trivial needs_implicit + // CHECK-NEXT: | `-CXXRecordDecl 0x{{.+}} col:31 implicit class TestClassTemplate2 + // CHECK-NEXT: `-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate2' + + struct S { + template static const T TestVarTemplate; // declaration of a static data member template + }; + template + const T S::TestVarTemplate = { }; // definition of a static data member template + + void f() + { + int i = S::TestVarTemplate; + int j = S::TestVarTemplate; + } + + // CHECK: VarTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-11]]:7, col:43> col:43 TestVarTemplate + // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} col:25 referenced typename depth 0 index 0 T + // CHECK-NEXT: |-VarDecl 0x{{.+}} col:43 TestVarTemplate 'const T' static + // CHECK-NEXT: |-VarTemplateSpecializationDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} col:14 referenced TestVarTemplate 'const int':'const int' cinit + // CHECK-NEXT: | |-TemplateArgument type 'int' + // CHECK-NEXT: | `-InitListExpr 0x{{.+}} 'int':'int' + // CHECK-NEXT: `-VarTemplateSpecializationDecl 0x{{.+}} 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-NEXT:`-TemplateArgument type 'int' + + // CHECK: VarTemplateDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-21]]:3, line:[[@LINE-20]]:34> col:14 TestVarTemplate + // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} col:21 referenced typename depth 0 index 0 T + // CHECK-NEXT: |-VarDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} col:14 TestVarTemplate 'const T' cinit + // CHECK-NEXT: | `-InitListExpr 0x{{.+}} '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-NEXT: |-TemplateArgument type 'int' + // CHECK-NEXT: `-InitListExpr 0x{{.+}} 'int':'int' +} template class TestClassScopeFunctionSpecialization {