| 1 | // RUN: %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -fms-extensions -ast-dump -ast-dump-filter Test %s | FileCheck -strict-whitespace %s
|
| 2 |
|
| 3 | class testEnumDecl {
|
| 4 | enum class TestEnumDeclScoped;
|
| 5 | enum TestEnumDeclFixed : int;
|
| 6 | };
|
| 7 | // CHECK: EnumDecl{{.*}} class TestEnumDeclScoped 'int'
|
| 8 | // CHECK: EnumDecl{{.*}} TestEnumDeclFixed 'int'
|
| 9 |
|
| 10 | class testFieldDecl {
|
| 11 | int TestFieldDeclInit = 0;
|
| 12 | };
|
| 13 | // CHECK: FieldDecl{{.*}} TestFieldDeclInit 'int'
|
| 14 | // CHECK-NEXT: IntegerLiteral
|
| 15 |
|
| 16 | namespace testVarDeclNRVO {
|
| 17 | class A { };
|
| 18 | A foo() {
|
| 19 | A TestVarDeclNRVO;
|
| 20 | return TestVarDeclNRVO;
|
| 21 | }
|
| 22 | }
|
| 23 | // CHECK: VarDecl{{.*}} TestVarDeclNRVO 'testVarDeclNRVO::A' nrvo
|
| 24 |
|
| 25 | void testParmVarDeclInit(int TestParmVarDeclInit = 0);
|
| 26 | // CHECK: ParmVarDecl{{.*}} TestParmVarDeclInit 'int'
|
| 27 | // CHECK-NEXT: IntegerLiteral{{.*}}
|
| 28 |
|
| 29 | namespace TestNamespaceDecl {
|
| 30 | int i;
|
| 31 | }
|
| 32 | // CHECK: NamespaceDecl{{.*}} TestNamespaceDecl
|
| 33 | // CHECK-NEXT: VarDecl
|
| 34 |
|
| 35 | namespace TestNamespaceDecl {
|
| 36 | int j;
|
| 37 | }
|
| 38 | // CHECK: NamespaceDecl{{.*}} TestNamespaceDecl
|
| 39 | // CHECK-NEXT: original Namespace
|
| 40 | // CHECK-NEXT: VarDecl
|
| 41 |
|
| 42 | inline namespace TestNamespaceDeclInline {
|
| 43 | }
|
| 44 | // CHECK: NamespaceDecl{{.*}} TestNamespaceDeclInline inline
|
| 45 |
|
| 46 | namespace testUsingDirectiveDecl {
|
| 47 | namespace A {
|
| 48 | }
|
| 49 | }
|
| 50 | namespace TestUsingDirectiveDecl {
|
| 51 | using namespace testUsingDirectiveDecl::A;
|
| 52 | }
|
| 53 | // CHECK: NamespaceDecl{{.*}} TestUsingDirectiveDecl
|
| 54 | // CHECK-NEXT: UsingDirectiveDecl{{.*}} Namespace{{.*}} 'A'
|
| 55 |
|
| 56 | namespace testNamespaceAlias {
|
| 57 | namespace A {
|
| 58 | }
|
| 59 | }
|
| 60 | namespace TestNamespaceAlias = testNamespaceAlias::A;
|
| 61 | // CHECK: NamespaceAliasDecl{{.*}} TestNamespaceAlias
|
| 62 | // CHECK-NEXT: Namespace{{.*}} 'A'
|
| 63 |
|
| 64 | using TestTypeAliasDecl = int;
|
| 65 | // CHECK: TypeAliasDecl{{.*}} TestTypeAliasDecl 'int'
|
| 66 |
|
| 67 | namespace testTypeAliasTemplateDecl {
|
| 68 | template<typename T> class A;
|
| 69 | template<typename T> using TestTypeAliasTemplateDecl = A<T>;
|
| 70 | }
|
| 71 | // CHECK: TypeAliasTemplateDecl{{.*}} TestTypeAliasTemplateDecl
|
| 72 | // CHECK-NEXT: TemplateTypeParmDecl
|
| 73 | // CHECK-NEXT: TypeAliasDecl{{.*}} TestTypeAliasTemplateDecl 'A<T>'
|
| 74 |
|
| 75 | namespace testCXXRecordDecl {
|
| 76 | class TestEmpty {};
|
| 77 | // CHECK: CXXRecordDecl{{.*}} class TestEmpty
|
| 78 | // 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
|
| 79 | // CHECK-NEXT: DefaultConstructor exists trivial constexpr
|
| 80 | // CHECK-NEXT: CopyConstructor simple trivial has_const_param
|
| 81 | // CHECK-NEXT: MoveConstructor exists simple trivial
|
| 82 | // CHECK-NEXT: CopyAssignment trivial has_const_param
|
| 83 | // CHECK-NEXT: MoveAssignment exists simple trivial
|
| 84 | // CHECK-NEXT: Destructor simple irrelevant trivial
|
| 85 |
|
| 86 | class A { };
|
| 87 | class B { };
|
| 88 | class TestCXXRecordDecl : virtual A, public B {
|
| 89 | int i;
|
| 90 | };
|
| 91 | }
|
| 92 | // CHECK: CXXRecordDecl{{.*}} class TestCXXRecordDecl
|
| 93 | // CHECK-NEXT: DefinitionData{{$}}
|
| 94 | // CHECK-NEXT: DefaultConstructor exists non_trivial
|
| 95 | // CHECK-NEXT: CopyConstructor simple non_trivial has_const_param
|
| 96 | // CHECK-NEXT: MoveConstructor exists simple non_trivial
|
| 97 | // CHECK-NEXT: CopyAssignment non_trivial has_const_param
|
| 98 | // CHECK-NEXT: MoveAssignment exists simple non_trivial
|
| 99 | // CHECK-NEXT: Destructor simple irrelevant trivial
|
| 100 | // CHECK-NEXT: virtual private 'testCXXRecordDecl::A'
|
| 101 | // CHECK-NEXT: public 'testCXXRecordDecl::B'
|
| 102 | // CHECK-NEXT: CXXRecordDecl{{.*}} class TestCXXRecordDecl
|
| 103 | // CHECK-NEXT: FieldDecl
|
| 104 |
|
| 105 | template<class...T>
|
| 106 | class TestCXXRecordDeclPack : public T... {
|
| 107 | };
|
| 108 | // CHECK: CXXRecordDecl{{.*}} class TestCXXRecordDeclPack
|
| 109 | // CHECK: public 'T'...
|
| 110 | // CHECK-NEXT: CXXRecordDecl{{.*}} class TestCXXRecordDeclPack
|
| 111 |
|
| 112 | thread_local int TestThreadLocalInt;
|
| 113 | // CHECK: TestThreadLocalInt {{.*}} tls_dynamic
|
| 114 |
|
| 115 | class testCXXMethodDecl {
|
| 116 | virtual void TestCXXMethodDeclPure() = 0;
|
| 117 | void TestCXXMethodDeclDelete() = delete;
|
| 118 | void TestCXXMethodDeclThrow() throw();
|
| 119 | void TestCXXMethodDeclThrowType() throw(int);
|
| 120 | };
|
| 121 | // CHECK: CXXMethodDecl{{.*}} TestCXXMethodDeclPure 'void ()' virtual pure
|
| 122 | // CHECK: CXXMethodDecl{{.*}} TestCXXMethodDeclDelete 'void ()' delete
|
| 123 | // CHECK: CXXMethodDecl{{.*}} TestCXXMethodDeclThrow 'void () throw()'
|
| 124 | // CHECK: CXXMethodDecl{{.*}} TestCXXMethodDeclThrowType 'void () throw(int)'
|
| 125 |
|
| 126 | namespace testCXXConstructorDecl {
|
| 127 | class A { };
|
| 128 | class TestCXXConstructorDecl : public A {
|
| 129 | int I;
|
| 130 | TestCXXConstructorDecl(A &a, int i) : A(a), I(i) { }
|
| 131 | TestCXXConstructorDecl(A &a) : TestCXXConstructorDecl(a, 0) { }
|
| 132 | };
|
| 133 | }
|
| 134 | // CHECK: CXXConstructorDecl{{.*}} TestCXXConstructorDecl 'void {{.*}}'
|
| 135 | // CHECK-NEXT: ParmVarDecl{{.*}} a
|
| 136 | // CHECK-NEXT: ParmVarDecl{{.*}} i
|
| 137 | // CHECK-NEXT: CXXCtorInitializer{{.*}}A
|
| 138 | // CHECK-NEXT: Expr
|
| 139 | // CHECK: CXXCtorInitializer{{.*}}I
|
| 140 | // CHECK-NEXT: Expr
|
| 141 | // CHECK: CompoundStmt
|
| 142 | // CHECK: CXXConstructorDecl{{.*}} TestCXXConstructorDecl 'void {{.*}}'
|
| 143 | // CHECK-NEXT: ParmVarDecl{{.*}} a
|
| 144 | // CHECK-NEXT: CXXCtorInitializer{{.*}}TestCXXConstructorDecl
|
| 145 | // CHECK-NEXT: CXXConstructExpr{{.*}}TestCXXConstructorDecl
|
| 146 |
|
| 147 | class TestCXXDestructorDecl {
|
| 148 | ~TestCXXDestructorDecl() { }
|
| 149 | };
|
| 150 | // CHECK: CXXDestructorDecl{{.*}} ~TestCXXDestructorDecl 'void () noexcept'
|
| 151 | // CHECK-NEXT: CompoundStmt
|
| 152 |
|
| 153 | // Test that the range of a defaulted members is computed correctly.
|
| 154 | class TestMemberRanges {
|
| 155 | public:
|
| 156 | TestMemberRanges() = default;
|
| 157 | TestMemberRanges(const TestMemberRanges &Other) = default;
|
| 158 | TestMemberRanges(TestMemberRanges &&Other) = default;
|
| 159 | ~TestMemberRanges() = default;
|
| 160 | TestMemberRanges &operator=(const TestMemberRanges &Other) = default;
|
| 161 | TestMemberRanges &operator=(TestMemberRanges &&Other) = default;
|
| 162 | };
|
| 163 | void SomeFunction() {
|
| 164 | TestMemberRanges A;
|
| 165 | TestMemberRanges B(A);
|
| 166 | B = A;
|
| 167 | A = static_cast<TestMemberRanges &&>(B);
|
| 168 | TestMemberRanges C(static_cast<TestMemberRanges &&>(A));
|
| 169 | }
|
| 170 | // CHECK: CXXConstructorDecl{{.*}} <line:{{.*}}:3, col:30>
|
| 171 | // CHECK: CXXConstructorDecl{{.*}} <line:{{.*}}:3, col:59>
|
| 172 | // CHECK: CXXConstructorDecl{{.*}} <line:{{.*}}:3, col:54>
|
| 173 | // CHECK: CXXDestructorDecl{{.*}} <line:{{.*}}:3, col:31>
|
| 174 | // CHECK: CXXMethodDecl{{.*}} <line:{{.*}}:3, col:70>
|
| 175 | // CHECK: CXXMethodDecl{{.*}} <line:{{.*}}:3, col:65>
|
| 176 |
|
| 177 | class TestCXXConversionDecl {
|
| 178 | operator int() { return 0; }
|
| 179 | };
|
| 180 | // CHECK: CXXConversionDecl{{.*}} operator int 'int ()'
|
| 181 | // CHECK-NEXT: CompoundStmt
|
| 182 |
|
| 183 | namespace TestStaticAssertDecl {
|
| 184 | static_assert(true, "msg");
|
| 185 | }
|
| 186 | // CHECK: NamespaceDecl{{.*}} TestStaticAssertDecl
|
| 187 | // CHECK-NEXT: StaticAssertDecl{{.*> .*$}}
|
| 188 | // CHECK-NEXT: CXXBoolLiteralExpr
|
| 189 | // CHECK-NEXT: StringLiteral
|
| 190 |
|
| 191 | namespace testFunctionTemplateDecl {
|
| 192 | class A { };
|
| 193 | class B { };
|
| 194 | class C { };
|
| 195 | class D { };
|
| 196 | template<typename T> void TestFunctionTemplate(T) { }
|
| 197 |
|
| 198 | // implicit instantiation
|
| 199 | void bar(A a) { TestFunctionTemplate(a); }
|
| 200 |
|
| 201 | // explicit specialization
|
| 202 | template<> void TestFunctionTemplate(B);
|
| 203 |
|
| 204 | // explicit instantiation declaration
|
| 205 | extern template void TestFunctionTemplate(C);
|
| 206 |
|
| 207 | // explicit instantiation definition
|
| 208 | template void TestFunctionTemplate(D);
|
| 209 | }
|
| 210 | // CHECK: FunctionTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-14]]:3, col:55> col:29 TestFunctionTemplate
|
| 211 | // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 referenced typename depth 0 index 0 T
|
| 212 | // CHECK-NEXT: |-FunctionDecl 0x{{.+}} <col:24, col:55> col:29 TestFunctionTemplate 'void (T)'
|
| 213 | // CHECK-NEXT: | |-ParmVarDecl 0x{{.+}} <col:50> col:51 'T'
|
| 214 | // CHECK-NEXT: | `-CompoundStmt 0x{{.+}} <col:53, col:55>
|
| 215 | // CHECK-NEXT: |-FunctionDecl 0x{{.+}} <col:24, col:55> col:29 used TestFunctionTemplate 'void (testFunctionTemplateDecl::A)'
|
| 216 | // CHECK-NEXT: | |-TemplateArgument type 'testFunctionTemplateDecl::A'
|
| 217 | // CHECK-NEXT: | |-ParmVarDecl 0x{{.+}} <col:50> col:51 'testFunctionTemplateDecl::A':'testFunctionTemplateDecl::A'
|
| 218 | // CHECK-NEXT: | `-CompoundStmt 0x{{.+}} <col:53, col:55>
|
| 219 | // CHECK-NEXT: |-Function 0x{{.+}} 'TestFunctionTemplate' 'void (testFunctionTemplateDecl::B)'
|
| 220 | // CHECK-NEXT: |-FunctionDecl 0x{{.+}} <col:24, col:55> col:29 TestFunctionTemplate 'void (testFunctionTemplateDecl::C)'
|
| 221 | // CHECK-NEXT: | |-TemplateArgument type 'testFunctionTemplateDecl::C'
|
| 222 | // CHECK-NEXT: | `-ParmVarDecl 0x{{.+}} <col:50> col:51 'testFunctionTemplateDecl::C':'testFunctionTemplateDecl::C'
|
| 223 | // CHECK-NEXT: `-FunctionDecl 0x{{.+}} <col:24, col:55> col:29 TestFunctionTemplate 'void (testFunctionTemplateDecl::D)'
|
| 224 | // CHECK-NEXT: |-TemplateArgument type 'testFunctionTemplateDecl::D'
|
| 225 | // CHECK-NEXT: |-ParmVarDecl 0x{{.+}} <col:50> col:51 'testFunctionTemplateDecl::D':'testFunctionTemplateDecl::D'
|
| 226 | // CHECK-NEXT: `-CompoundStmt 0x{{.+}} <col:53, col:55>
|
| 227 |
|
| 228 | // CHECK: FunctionDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-26]]:3, col:41> col:19 TestFunctionTemplate 'void (testFunctionTemplateDecl::B)'
|
| 229 | // CHECK-NEXT: |-TemplateArgument type 'testFunctionTemplateDecl::B'
|
| 230 | // CHECK-NEXT: `-ParmVarDecl 0x{{.+}} <col:40> col:41 'testFunctionTemplateDecl::B'
|
| 231 |
|
| 232 |
|
| 233 | namespace testClassTemplateDecl {
|
| 234 | class A { };
|
| 235 | class B { };
|
| 236 | class C { };
|
| 237 | class D { };
|
| 238 |
|
| 239 | template<typename T> class TestClassTemplate {
|
| 240 | public:
|
| 241 | TestClassTemplate();
|
| 242 | ~TestClassTemplate();
|
| 243 | int j();
|
| 244 | int i;
|
| 245 | };
|
| 246 |
|
| 247 | // implicit instantiation
|
| 248 | TestClassTemplate<A> a;
|
| 249 |
|
| 250 | // explicit specialization
|
| 251 | template<> class TestClassTemplate<B> {
|
| 252 | int j;
|
| 253 | };
|
| 254 |
|
| 255 | // explicit instantiation declaration
|
| 256 | extern template class TestClassTemplate<C>;
|
| 257 |
|
| 258 | // explicit instantiation definition
|
| 259 | template class TestClassTemplate<D>;
|
| 260 |
|
| 261 | // partial explicit specialization
|
| 262 | template<typename T1, typename T2> class TestClassTemplatePartial {
|
| 263 | int i;
|
| 264 | };
|
| 265 | template<typename T1> class TestClassTemplatePartial<T1, A> {
|
| 266 | int j;
|
| 267 | };
|
| 268 |
|
| 269 | template<typename T = int> struct TestTemplateDefaultType;
|
| 270 | template<typename T> struct TestTemplateDefaultType { };
|
| 271 |
|
| 272 | template<int I = 42> struct TestTemplateDefaultNonType;
|
| 273 | template<int I> struct TestTemplateDefaultNonType { };
|
| 274 |
|
| 275 | template<template<typename> class TT = TestClassTemplate> struct TestTemplateTemplateDefaultType;
|
| 276 | template<template<typename> class TT> struct TestTemplateTemplateDefaultType { };
|
| 277 | }
|
| 278 |
|
| 279 | // CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-40]]:3, line:[[@LINE-34]]:3> line:[[@LINE-40]]:30 TestClassTemplate
|
| 280 | // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T
|
| 281 | // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} <col:24, line:[[@LINE-36]]:3> line:[[@LINE-42]]:30 class TestClassTemplate definition
|
| 282 | // CHECK-NEXT: | |-DefinitionData standard_layout has_user_declared_ctor can_const_default_init
|
| 283 | // CHECK-NEXT: | | |-DefaultConstructor exists non_trivial user_provided
|
| 284 | // CHECK-NEXT: | | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
|
| 285 | // CHECK-NEXT: | | |-MoveConstructor
|
| 286 | // CHECK-NEXT: | | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param
|
| 287 | // CHECK-NEXT: | | |-MoveAssignment
|
| 288 | // CHECK-NEXT: | | `-Destructor non_trivial user_declared
|
| 289 | // CHECK-NEXT: | |-CXXRecordDecl 0x{{.+}} <col:24, col:30> col:30 implicit referenced class TestClassTemplate
|
| 290 | // CHECK-NEXT: | |-AccessSpecDecl 0x{{.+}} <line:[[@LINE-50]]:3, col:9> col:3 public
|
| 291 | // CHECK-NEXT: | |-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-50]]:5, col:23> col:5 TestClassTemplate<T> 'void ()'
|
| 292 | // CHECK-NEXT: | |-CXXDestructorDecl 0x{{.+}} <line:[[@LINE-50]]:5, col:24> col:5 ~TestClassTemplate<T> 'void ()'
|
| 293 | // CHECK-NEXT: | |-CXXMethodDecl 0x{{.+}} <line:[[@LINE-50]]:5, col:11> col:9 j 'int ()'
|
| 294 | // CHECK-NEXT: | `-FieldDecl 0x{{.+}} <line:[[@LINE-50]]:5, col:9> col:9 i 'int'
|
| 295 | // CHECK-NEXT: |-ClassTemplateSpecializationDecl 0x{{.+}} <line:[[@LINE-56]]:3, line:[[@LINE-50]]:3> line:[[@LINE-56]]:30 class TestClassTemplate definition
|
| 296 | // CHECK-NEXT: | |-DefinitionData standard_layout has_user_declared_ctor can_const_default_init
|
| 297 | // CHECK-NEXT: | | |-DefaultConstructor exists non_trivial user_provided
|
| 298 | // CHECK-NEXT: | | |-CopyConstructor simple trivial has_const_param implicit_has_const_param
|
| 299 | // CHECK-NEXT: | | |-MoveConstructor
|
| 300 | // CHECK-NEXT: | | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param
|
| 301 | // CHECK-NEXT: | | |-MoveAssignment
|
| 302 | // CHECK-NEXT: | | `-Destructor non_trivial user_declared
|
| 303 | // CHECK-NEXT: | |-TemplateArgument type 'testClassTemplateDecl::A'
|
| 304 | // CHECK-NEXT: | |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <col:24, col:30> col:30 implicit class TestClassTemplate
|
| 305 | // CHECK-NEXT: | |-AccessSpecDecl 0x{{.+}} <line:[[@LINE-65]]:3, col:9> col:3 public
|
| 306 | // CHECK-NEXT: | |-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-65]]:5, col:23> col:5 used TestClassTemplate 'void ()'
|
| 307 | // CHECK-NEXT: | |-CXXDestructorDecl 0x{{.+}} <line:[[@LINE-65]]:5, col:24> col:5 used ~TestClassTemplate 'void () noexcept'
|
| 308 | // CHECK-NEXT: | |-CXXMethodDecl 0x{{.+}} <line:[[@LINE-65]]:5, col:11> col:9 j 'int ()'
|
| 309 | // CHECK-NEXT: | |-FieldDecl 0x{{.+}} <line:[[@LINE-65]]:5, col:9> col:9 i 'int'
|
| 310 | // 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{{.+}}
|
| 311 | // CHECK-NEXT: | `-ParmVarDecl 0x{{.+}} <col:30> col:30 'const testClassTemplateDecl::TestClassTemplate<testClassTemplateDecl::A> &'
|
| 312 | // CHECK-NEXT: |-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate'
|
| 313 | // CHECK-NEXT: |-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate'
|
| 314 | // CHECK-NEXT: `-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate'
|
| 315 |
|
| 316 | // CHECK: ClassTemplateSpecializationDecl 0x{{.+}} <{{.+}}:[[@LINE-65]]:3, line:[[@LINE-63]]:3> line:[[@LINE-65]]:20 class TestClassTemplate definition
|
| 317 | // CHECK-NEXT: |-DefinitionData pass_in_registers standard_layout trivially_copyable trivial literal
|
| 318 | // CHECK-NEXT: | |-DefaultConstructor exists trivial needs_implicit
|
| 319 | // CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
|
| 320 | // CHECK-NEXT: | |-MoveConstructor exists simple trivial needs_implicit
|
| 321 | // CHECK-NEXT: | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param
|
| 322 | // CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit
|
| 323 | // CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit
|
| 324 | // CHECK-NEXT: |-TemplateArgument type 'testClassTemplateDecl::B'
|
| 325 | // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} <col:14, col:20> col:20 implicit class TestClassTemplate
|
| 326 | // CHECK-NEXT: `-FieldDecl 0x{{.+}} <line:[[@LINE-74]]:5, col:9> col:9 j 'int'
|
| 327 |
|
| 328 | // CHECK: ClassTemplateSpecializationDecl 0x{{.+}} <{{.+}}:256:3, col:44> col:25 class TestClassTemplate definition
|
| 329 | // CHECK-NEXT: |-DefinitionData standard_layout has_user_declared_ctor can_const_default_init
|
| 330 | // CHECK-NEXT: | |-DefaultConstructor exists non_trivial user_provided
|
| 331 | // CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
|
| 332 | // CHECK-NEXT: | |-MoveConstructor
|
| 333 | // CHECK-NEXT: | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param
|
| 334 | // CHECK-NEXT: | |-MoveAssignment
|
| 335 | // CHECK-NEXT: | `-Destructor non_trivial user_declared
|
| 336 | // CHECK-NEXT: |-TemplateArgument type 'testClassTemplateDecl::C'
|
| 337 | // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <line:[[@LINE-98]]:24, col:30> col:30 implicit class TestClassTemplate
|
| 338 | // CHECK-NEXT: |-AccessSpecDecl 0x{{.+}} <line:[[@LINE-98]]:3, col:9> col:3 public
|
| 339 | // CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-98]]:5, col:23> col:5 TestClassTemplate 'void ()'
|
| 340 | // CHECK-NEXT: |-CXXDestructorDecl 0x{{.+}} <line:[[@LINE-98]]:5, col:24> col:5 ~TestClassTemplate 'void ()' noexcept-unevaluated 0x{{.+}}
|
| 341 | // CHECK-NEXT: |-CXXMethodDecl 0x{{.+}} <line:[[@LINE-98]]:5, col:11> col:9 j 'int ()'
|
| 342 | // CHECK-NEXT: `-FieldDecl 0x{{.+}} <line:[[@LINE-98]]:5, col:9> col:9 i 'int'
|
| 343 |
|
| 344 | // CHECK: ClassTemplateSpecializationDecl 0x{{.+}} <{{.+}}:[[@LINE-85]]:3, col:37> col:18 class TestClassTemplate definition
|
| 345 | // CHECK-NEXT: |-DefinitionData standard_layout has_user_declared_ctor can_const_default_init
|
| 346 | // CHECK-NEXT: | |-DefaultConstructor exists non_trivial user_provided
|
| 347 | // CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
|
| 348 | // CHECK-NEXT: | |-MoveConstructor
|
| 349 | // CHECK-NEXT: | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param
|
| 350 | // CHECK-NEXT: | |-MoveAssignment
|
| 351 | // CHECK-NEXT: | `-Destructor non_trivial user_declared
|
| 352 | // CHECK-NEXT: |-TemplateArgument type 'testClassTemplateDecl::D'
|
| 353 | // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <line:[[@LINE-114]]:24, col:30> col:30 implicit class TestClassTemplate
|
| 354 | // CHECK-NEXT: |-AccessSpecDecl 0x{{.+}} <line:[[@LINE-114]]:3, col:9> col:3 public
|
| 355 | // CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-114]]:5, col:23> col:5 TestClassTemplate 'void ()'
|
| 356 | // CHECK-NEXT: |-CXXDestructorDecl 0x{{.+}} <line:[[@LINE-114]]:5, col:24> col:5 ~TestClassTemplate 'void ()' noexcept-unevaluated 0x{{.+}}
|
| 357 | // CHECK-NEXT: |-CXXMethodDecl 0x{{.+}} <line:[[@LINE-114]]:5, col:11> col:9 j 'int ()'
|
| 358 | // CHECK-NEXT: `-FieldDecl 0x{{.+}} <line:[[@LINE-114]]:5, col:9> col:9 i 'int'
|
| 359 |
|
| 360 | // CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-98]]:3, line:[[@LINE-96]]:3> line:[[@LINE-98]]:44 TestClassTemplatePartial
|
| 361 | // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T1
|
| 362 | // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:25, col:34> col:34 typename depth 0 index 1 T2
|
| 363 | // CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} <col:38, line:[[@LINE-99]]:3> line:[[@LINE-101]]:44 class TestClassTemplatePartial definition
|
| 364 | // CHECK-NEXT: |-DefinitionData standard_layout trivially_copyable trivial literal
|
| 365 | // CHECK-NEXT: | |-DefaultConstructor exists trivial needs_implicit
|
| 366 | // CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
|
| 367 | // CHECK-NEXT: | |-MoveConstructor exists simple trivial needs_implicit
|
| 368 | // CHECK-NEXT: | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param
|
| 369 | // CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit
|
| 370 | // CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit
|
| 371 | // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} <col:38, col:44> col:44 implicit class TestClassTemplatePartial
|
| 372 | // CHECK-NEXT: `-FieldDecl 0x{{.+}} <line:[[@LINE-109]]:5, col:9> col:9 i 'int'
|
| 373 |
|
| 374 | // CHECK: ClassTemplatePartialSpecializationDecl 0x{{.+}} <{{.+}}:[[@LINE-109]]:3, line:[[@LINE-107]]:3> line:[[@LINE-109]]:31 class TestClassTemplatePartial definition
|
| 375 | // CHECK-NEXT: |-DefinitionData standard_layout trivially_copyable trivial literal
|
| 376 | // CHECK-NEXT: | |-DefaultConstructor exists trivial needs_implicit
|
| 377 | // CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
|
| 378 | // CHECK-NEXT: | |-MoveConstructor exists simple trivial needs_implicit
|
| 379 | // CHECK-NEXT: | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param
|
| 380 | // CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit
|
| 381 | // CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit
|
| 382 | // CHECK-NEXT: |-TemplateArgument type 'type-parameter-0-0'
|
| 383 | // CHECK-NEXT: |-TemplateArgument type 'testClassTemplateDecl::A'
|
| 384 | // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 referenced typename depth 0 index 0 T1
|
| 385 | // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} <col:25, col:31> col:31 implicit class TestClassTemplatePartial
|
| 386 | // CHECK-NEXT: `-FieldDecl 0x{{.+}} <line:[[@LINE-120]]:5, col:9> col:9 j 'int'
|
| 387 |
|
| 388 | // CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-119]]:3, col:37> col:37 TestTemplateDefaultType
|
| 389 | // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:25> col:21 typename depth 0 index 0 T
|
| 390 | // CHECK-NEXT: | `-TemplateArgument type 'int'
|
| 391 | // CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} <col:30, col:37> col:37 struct TestTemplateDefaultType
|
| 392 |
|
| 393 | // CHECK: ClassTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-123]]:3, col:57> col:31 TestTemplateDefaultType
|
| 394 | // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T
|
| 395 | // CHECK-NEXT: | `-TemplateArgument type 'int'
|
| 396 | // CHECK-NEXT: | `-inherited from TemplateTypeParm 0x{{.+}} 'T'
|
| 397 | // CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <col:24, col:57> col:31 struct TestTemplateDefaultType definition
|
| 398 | // CHECK-NEXT: |-DefinitionData empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
|
| 399 | // CHECK-NEXT: | |-DefaultConstructor exists trivial constexpr needs_implicit defaulted_is_constexpr
|
| 400 | // CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
|
| 401 | // CHECK-NEXT: | |-MoveConstructor exists simple trivial needs_implicit
|
| 402 | // CHECK-NEXT: | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param
|
| 403 | // CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit
|
| 404 | // CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit
|
| 405 | // CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} <col:24, col:31> col:31 implicit struct TestTemplateDefaultType
|
| 406 |
|
| 407 | // CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-135]]:3, col:31> col:31 TestTemplateDefaultNonType
|
| 408 | // CHECK-NEXT: |-NonTypeTemplateParmDecl 0x{{.+}} <col:12, col:20> col:16 'int' depth 0 index 0 I
|
| 409 | // CHECK-NEXT: | `-TemplateArgument expr
|
| 410 | // CHECK-NEXT: | `-ConstantExpr 0x{{.+}} <col:20> 'int'
|
| 411 | // CHECK-NEXT: | `-IntegerLiteral 0x{{.+}} <col:20> 'int' 42
|
| 412 | // CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} <col:24, col:31> col:31 struct TestTemplateDefaultNonType
|
| 413 |
|
| 414 | // CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:275:3, col:68> col:68 TestTemplateTemplateDefaultType
|
| 415 | // CHECK-NEXT: |-TemplateTemplateParmDecl 0x{{.+}} <col:12, col:42> col:37 depth 0 index 0 TT
|
| 416 | // CHECK-NEXT: | |-TemplateTypeParmDecl 0x{{.+}} <col:21> col:21 typename depth 1 index 0
|
| 417 | // CHECK-NEXT: | `-TemplateArgument <col:42> template TestClassTemplate
|
| 418 | // CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} <col:61, col:68> col:68 struct TestTemplateTemplateDefaultType
|
| 419 |
|
| 420 | // CHECK: ClassTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:276:3, col:82> col:48 TestTemplateTemplateDefaultType
|
| 421 | // CHECK-NEXT: |-TemplateTemplateParmDecl 0x{{.+}} <col:12, col:37> col:37 depth 0 index 0 TT
|
| 422 | // CHECK-NEXT: | |-TemplateTypeParmDecl 0x{{.+}} <col:21> col:21 typename depth 1 index 0
|
| 423 | // CHECK-NEXT: | `-TemplateArgument <line:275:42> template TestClassTemplate
|
| 424 | // CHECK-NEXT: | `-inherited from TemplateTemplateParm 0x{{.+}} 'TT'
|
| 425 | // CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <line:276:41, col:82> col:48 struct TestTemplateTemplateDefaultType definition
|
| 426 | // CHECK-NEXT: |-DefinitionData empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
|
| 427 | // CHECK-NEXT: | |-DefaultConstructor exists trivial constexpr needs_implicit defaulted_is_constexpr
|
| 428 | // CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
|
| 429 | // CHECK-NEXT: | |-MoveConstructor exists simple trivial needs_implicit
|
| 430 | // CHECK-NEXT: | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param
|
| 431 | // CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit
|
| 432 | // CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit
|
| 433 | // CHECK-NEXT: `-CXXRecordDecl 0x{{.+}} <col:41, col:48> col:48 implicit struct TestTemplateTemplateDefaultType
|
| 434 |
|
| 435 |
|
| 436 | // PR15220 dump instantiation only once
|
| 437 | namespace testCanonicalTemplate {
|
| 438 | class A {};
|
| 439 |
|
| 440 | template<typename T> void TestFunctionTemplate(T);
|
| 441 | template<typename T> void TestFunctionTemplate(T);
|
| 442 | void bar(A a) { TestFunctionTemplate(a); }
|
| 443 | // CHECK: FunctionTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-3]]:3, col:51> col:29 TestFunctionTemplate
|
| 444 | // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 referenced typename depth 0 index 0 T
|
| 445 | // CHECK-NEXT: |-FunctionDecl 0x{{.*}} <col:24, col:51> col:29 TestFunctionTemplate 'void (T)'
|
| 446 | // CHECK-NEXT: | `-ParmVarDecl 0x{{.*}} <col:50> col:51 'T'
|
| 447 | // CHECK-NEXT: `-FunctionDecl 0x{{.*}} <line:[[@LINE-6]]:24, col:51> col:29 used TestFunctionTemplate 'void (testCanonicalTemplate::A)'
|
| 448 | // CHECK-NEXT: |-TemplateArgument type 'testCanonicalTemplate::A'
|
| 449 | // CHECK-NEXT: `-ParmVarDecl 0x{{.*}} <col:50> col:51 'testCanonicalTemplate::A':'testCanonicalTemplate::A'
|
| 450 |
|
| 451 | // CHECK: FunctionTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-10]]:3, col:51> col:29 TestFunctionTemplate
|
| 452 | // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 referenced typename depth 0 index 0 T
|
| 453 | // CHECK-NEXT: |-FunctionDecl{{.*}} 0x{{.+}} prev 0x{{.+}} <col:24, col:51> col:29 TestFunctionTemplate 'void (T)'
|
| 454 | // CHECK-NEXT: | `-ParmVarDecl 0x{{.+}} <col:50> col:51 'T'
|
| 455 | // CHECK-NEXT: `-Function 0x{{.+}} 'TestFunctionTemplate' 'void (testCanonicalTemplate::A)'
|
| 456 | // CHECK-NOT: TemplateArgument
|
| 457 |
|
| 458 | template<typename T1> class TestClassTemplate {
|
| 459 | template<typename T2> friend class TestClassTemplate;
|
| 460 | };
|
| 461 | TestClassTemplate<A> a;
|
| 462 | // CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-4]]:3, line:[[@LINE-2]]:3> line:[[@LINE-4]]:31 TestClassTemplate
|
| 463 | // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T1
|
| 464 | // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} <col:25, line:[[@LINE-4]]:3> line:[[@LINE-6]]:31 class TestClassTemplate definition
|
| 465 | // CHECK-NEXT: | |-DefinitionData empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
|
| 466 | // CHECK-NEXT: | | |-DefaultConstructor exists trivial constexpr needs_implicit defaulted_is_constexpr
|
| 467 | // CHECK-NEXT: | | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
|
| 468 | // CHECK-NEXT: | | |-MoveConstructor exists simple trivial needs_implicit
|
| 469 | // CHECK-NEXT: | | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param
|
| 470 | // CHECK-NEXT: | | |-MoveAssignment exists simple trivial needs_implicit
|
| 471 | // CHECK-NEXT: | | `-Destructor simple irrelevant trivial needs_implicit
|
| 472 | // CHECK-NEXT: | |-CXXRecordDecl 0x{{.+}} <col:25, col:31> col:31 implicit class TestClassTemplate
|
| 473 | // CHECK-NEXT: | `-FriendDecl 0x{{.+}} <line:[[@LINE-14]]:5, col:40> col:40
|
| 474 | // CHECK-NEXT: | `-ClassTemplateDecl 0x{{.+}} parent 0x{{.+}} <col:5, col:40> col:40 TestClassTemplate
|
| 475 | // CHECK-NEXT: | |-TemplateTypeParmDecl 0x{{.+}} <col:14, col:23> col:23 typename depth 1 index 0 T2
|
| 476 | // CHECK-NEXT: | `-CXXRecordDecl 0x{{.+}} parent 0x{{.+}} <col:34, col:40> col:40 class TestClassTemplate
|
| 477 | // CHECK-NEXT: `-ClassTemplateSpecializationDecl 0x{{.+}} <line:[[@LINE-19]]:3, line:[[@LINE-17]]:3> line:[[@LINE-19]]:31 class TestClassTemplate definition
|
| 478 | // 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
|
| 479 | // CHECK-NEXT: | |-DefaultConstructor exists trivial constexpr defaulted_is_constexpr
|
| 480 | // CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param implicit_has_const_param
|
| 481 | // CHECK-NEXT: | |-MoveConstructor exists simple trivial
|
| 482 | // CHECK-NEXT: | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param
|
| 483 | // CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit
|
| 484 | // CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit
|
| 485 | // CHECK-NEXT: |-TemplateArgument type 'testCanonicalTemplate::A'
|
| 486 | // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <col:25, col:31> col:31 implicit class TestClassTemplate
|
| 487 | // CHECK-NEXT: |-FriendDecl 0x{{.+}} <line:[[@LINE-28]]:5, col:40> col:40
|
| 488 | // CHECK-NEXT: | `-ClassTemplateDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <col:5, col:40> col:40 TestClassTemplate
|
| 489 | // CHECK-NEXT: | |-TemplateTypeParmDecl 0x{{.+}} <col:14, col:23> col:23 typename depth 0 index 0 T2
|
| 490 | // CHECK-NEXT: | |-CXXRecordDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <col:34, col:40> col:40 class TestClassTemplate
|
| 491 | // CHECK-NEXT: | `-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate'
|
| 492 | // CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-34]]:31> col:31 implicit used constexpr TestClassTemplate 'void () noexcept' inline default trivial
|
| 493 | // CHECK-NEXT: | `-CompoundStmt 0x{{.+}} <col:31>
|
| 494 | // CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} <col:31> col:31 implicit constexpr TestClassTemplate 'void (const testCanonicalTemplate::TestClassTemplate<testCanonicalTemplate::A> &)' inline default trivial noexcept-unevaluated 0x{{.+}}
|
| 495 | // CHECK-NEXT: | `-ParmVarDecl 0x{{.+}} <col:31> col:31 'const testCanonicalTemplate::TestClassTemplate<testCanonicalTemplate::A> &'
|
| 496 | // CHECK-NEXT: `-CXXConstructorDecl 0x{{.+}} <col:31> col:31 implicit constexpr TestClassTemplate 'void (testCanonicalTemplate::TestClassTemplate<testCanonicalTemplate::A> &&)' inline default trivial noexcept-unevaluated 0x{{.+}}
|
| 497 | // CHECK-NEXT: `-ParmVarDecl 0x{{.+}} <col:31> col:31 'testCanonicalTemplate::TestClassTemplate<testCanonicalTemplate::A> &&'
|
| 498 |
|
| 499 |
|
| 500 | template<typename T1> class TestClassTemplate2;
|
| 501 | template<typename T1> class TestClassTemplate2;
|
| 502 | template<typename T1> class TestClassTemplate2 {
|
| 503 | };
|
| 504 | TestClassTemplate2<A> a2;
|
| 505 | // CHECK: ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-5]]:3, col:31> col:31 TestClassTemplate2
|
| 506 | // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T1
|
| 507 | // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} <col:25, col:31> col:31 class TestClassTemplate2
|
| 508 | // CHECK-NEXT: `-ClassTemplateSpecializationDecl 0x{{.+}} <line:[[@LINE-6]]:3, line:[[@LINE-5]]:3> line:[[@LINE-6]]:31 class TestClassTemplate2 definition
|
| 509 | // 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
|
| 510 | // CHECK-NEXT: | |-DefaultConstructor exists trivial constexpr defaulted_is_constexpr
|
| 511 | // CHECK-NEXT: | |-CopyConstructor simple trivial has_const_param implicit_has_const_param
|
| 512 | // CHECK-NEXT: | |-MoveConstructor exists simple trivial
|
| 513 | // CHECK-NEXT: | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param
|
| 514 | // CHECK-NEXT: | |-MoveAssignment exists simple trivial needs_implicit
|
| 515 | // CHECK-NEXT: | `-Destructor simple irrelevant trivial needs_implicit
|
| 516 | // CHECK-NEXT: |-TemplateArgument type 'testCanonicalTemplate::A'
|
| 517 | // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <col:25, col:31> col:31 implicit class TestClassTemplate2
|
| 518 | // CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} <col:31> col:31 implicit used constexpr TestClassTemplate2 'void () noexcept' inline default trivial
|
| 519 | // CHECK-NEXT: | `-CompoundStmt 0x{{.+}} <col:31>
|
| 520 | // CHECK-NEXT: |-CXXConstructorDecl 0x{{.+}} <col:31> col:31 implicit constexpr TestClassTemplate2 'void (const testCanonicalTemplate::TestClassTemplate2<testCanonicalTemplate::A> &)' inline default trivial noexcept-unevaluated 0x{{.+}}
|
| 521 | // CHECK-NEXT: | `-ParmVarDecl 0x{{.+}} <col:31> col:31 'const testCanonicalTemplate::TestClassTemplate2<testCanonicalTemplate::A> &'
|
| 522 | // CHECK-NEXT: `-CXXConstructorDecl 0x{{.+}} <col:31> col:31 implicit constexpr TestClassTemplate2 'void (testCanonicalTemplate::TestClassTemplate2<testCanonicalTemplate::A> &&)' inline default trivial noexcept-unevaluated 0x{{.+}}
|
| 523 | // CHECK-NEXT: `-ParmVarDecl 0x{{.+}} <col:31> col:31 'testCanonicalTemplate::TestClassTemplate2<testCanonicalTemplate::A> &&'
|
| 524 |
|
| 525 | // CHECK: ClassTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-24]]:3, col:31> col:31 TestClassTemplate2
|
| 526 | // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T1
|
| 527 | // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <col:25, col:31> col:31 class TestClassTemplate2
|
| 528 | // CHECK-NEXT: `-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate2'
|
| 529 |
|
| 530 | // CHECK: ClassTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-28]]:3, line:[[@LINE-27]]:3> line:[[@LINE-28]]:31 TestClassTemplate2
|
| 531 | // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T1
|
| 532 | // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <col:25, line:[[@LINE-29]]:3> line:[[@LINE-30]]:31 class TestClassTemplate2 definition
|
| 533 | // CHECK-NEXT: | |-DefinitionData empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init
|
| 534 | // CHECK-NEXT: | | |-DefaultConstructor exists trivial constexpr needs_implicit defaulted_is_constexpr
|
| 535 | // CHECK-NEXT: | | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param
|
| 536 | // CHECK-NEXT: | | |-MoveConstructor exists simple trivial needs_implicit
|
| 537 | // CHECK-NEXT: | | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param
|
| 538 | // CHECK-NEXT: | | |-MoveAssignment exists simple trivial needs_implicit
|
| 539 | // CHECK-NEXT: | | `-Destructor simple irrelevant trivial needs_implicit
|
| 540 | // CHECK-NEXT: | `-CXXRecordDecl 0x{{.+}} <col:25, col:31> col:31 implicit class TestClassTemplate2
|
| 541 | // CHECK-NEXT: `-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate2'
|
| 542 |
|
| 543 | struct S {
|
| 544 | template<typename T> static const T TestVarTemplate; // declaration of a static data member template
|
| 545 | };
|
| 546 | template<typename T>
|
| 547 | const T S::TestVarTemplate = { }; // definition of a static data member template
|
| 548 |
|
| 549 | void f()
|
| 550 | {
|
| 551 | int i = S::TestVarTemplate<int>;
|
| 552 | int j = S::TestVarTemplate<int>;
|
| 553 | }
|
| 554 |
|
| 555 | // CHECK: VarTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-11]]:7, col:43> col:43 TestVarTemplate
|
| 556 | // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:16, col:25> col:25 referenced typename depth 0 index 0 T
|
| 557 | // CHECK-NEXT: |-VarDecl 0x{{.+}} <col:28, col:43> col:43 TestVarTemplate 'const T' static
|
| 558 | // CHECK-NEXT: |-VarTemplateSpecializationDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <line:[[@LINE-11]]:3, col:34> col:14 referenced TestVarTemplate 'const int':'const int' cinit
|
| 559 | // CHECK-NEXT: | |-TemplateArgument type 'int'
|
| 560 | // CHECK-NEXT: | `-InitListExpr 0x{{.+}} <col:32, col:34> 'int':'int'
|
| 561 | // CHECK-NEXT: `-VarTemplateSpecializationDecl 0x{{.+}} <line:[[@LINE-17]]:28, col:43> col:43 referenced TestVarTemplate 'const int':'const int' static
|
| 562 | // CHECK-NEXT: `-TemplateArgument type 'int'
|
| 563 |
|
| 564 | // CHECK: VarTemplateSpecializationDecl 0x{{.+}} <{{.+}}:[[@LINE-20]]:28, col:43> col:43 referenced TestVarTemplate 'const int':'const int' static
|
| 565 | // CHECK-NEXT:`-TemplateArgument type 'int'
|
| 566 |
|
| 567 | // CHECK: VarTemplateDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-21]]:3, line:[[@LINE-20]]:34> col:14 TestVarTemplate
|
| 568 | // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <line:[[@LINE-22]]:12, col:21> col:21 referenced typename depth 0 index 0 T
|
| 569 | // CHECK-NEXT: |-VarDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <line:[[@LINE-22]]:3, col:34> col:14 TestVarTemplate 'const T' cinit
|
| 570 | // CHECK-NEXT: | `-InitListExpr 0x{{.+}} <col:32, col:34> 'void'
|
| 571 | // CHECK-NEXT: |-VarTemplateSpecialization 0x{{.+}} 'TestVarTemplate' 'const int':'const int'
|
| 572 | // CHECK-NEXT: `-VarTemplateSpecialization 0x{{.+}} 'TestVarTemplate' 'const int':'const int'
|
| 573 |
|
| 574 | // CHECK: VarTemplateSpecializationDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-27]]:3, col:34> col:14 referenced TestVarTemplate 'const int':'const int' cinit
|
| 575 | // CHECK-NEXT: |-TemplateArgument type 'int'
|
| 576 | // CHECK-NEXT: `-InitListExpr 0x{{.+}} <col:32, col:34> 'int':'int'
|
| 577 | }
|
| 578 |
|
| 579 | template <class T>
|
| 580 | class TestClassScopeFunctionSpecialization {
|
| 581 | template<class U> void foo(U a) { }
|
| 582 | template<> void foo<int>(int a) { }
|
| 583 | };
|
| 584 | // CHECK: ClassScopeFunctionSpecializationDecl
|
| 585 | // CHECK-NEXT: CXXMethod{{.*}} foo 'void (int)'
|
| 586 | // CHECK-NEXT: ParmVarDecl
|
| 587 | // CHECK-NEXT: CompoundStmt
|
| 588 | // CHECK-NEXT: TemplateArgument{{.*}} 'int'
|
| 589 |
|
| 590 | namespace TestTemplateTypeParmDecl {
|
| 591 | template<typename ... T, class U = int> void foo();
|
| 592 | }
|
| 593 | // CHECK: NamespaceDecl{{.*}} TestTemplateTypeParmDecl
|
| 594 | // CHECK-NEXT: FunctionTemplateDecl
|
| 595 | // CHECK-NEXT: TemplateTypeParmDecl{{.*}} typename depth 0 index 0 ... T
|
| 596 | // CHECK-NEXT: TemplateTypeParmDecl{{.*}} class depth 0 index 1 U
|
| 597 | // CHECK-NEXT: TemplateArgument type 'int'
|
| 598 |
|
| 599 | namespace TestNonTypeTemplateParmDecl {
|
| 600 | template<int I = 1, int ... J> void foo();
|
| 601 | }
|
| 602 | // CHECK: NamespaceDecl{{.*}} TestNonTypeTemplateParmDecl
|
| 603 | // CHECK-NEXT: FunctionTemplateDecl
|
| 604 | // CHECK-NEXT: NonTypeTemplateParmDecl{{.*}} 'int' depth 0 index 0 I
|
| 605 | // CHECK-NEXT: TemplateArgument expr
|
| 606 | // CHECK-NEXT: ConstantExpr{{.*}} 'int'
|
| 607 | // CHECK-NEXT: IntegerLiteral{{.*}} 'int' 1
|
| 608 | // CHECK-NEXT: NonTypeTemplateParmDecl{{.*}} 'int' depth 0 index 1 ... J
|
| 609 |
|
| 610 | namespace TestTemplateTemplateParmDecl {
|
| 611 | template<typename T> class A;
|
| 612 | template <template <typename> class T = A, template <typename> class ... U> void foo();
|
| 613 | }
|
| 614 | // CHECK: NamespaceDecl{{.*}} TestTemplateTemplateParmDecl
|
| 615 | // CHECK: FunctionTemplateDecl
|
| 616 | // CHECK-NEXT: TemplateTemplateParmDecl{{.*}} T
|
| 617 | // CHECK-NEXT: TemplateTypeParmDecl{{.*}} typename
|
| 618 | // CHECK-NEXT: TemplateArgument{{.*}} template A
|
| 619 | // CHECK-NEXT: TemplateTemplateParmDecl{{.*}} ... U
|
| 620 | // CHECK-NEXT: TemplateTypeParmDecl{{.*}} typename
|
| 621 |
|
| 622 | namespace TestTemplateArgument {
|
| 623 | template<typename> class A { };
|
| 624 | template<template<typename> class ...> class B { };
|
| 625 | int foo();
|
| 626 |
|
| 627 | template<typename> class testType { };
|
| 628 | template class testType<int>;
|
| 629 | // CHECK: ClassTemplateSpecializationDecl{{.*}} class testType
|
| 630 | // CHECK: TemplateArgument{{.*}} type 'int'
|
| 631 |
|
| 632 | template<int fp(void)> class testDecl { };
|
| 633 | template class testDecl<foo>;
|
| 634 | // CHECK: ClassTemplateSpecializationDecl{{.*}} class testDecl
|
| 635 | // CHECK: TemplateArgument{{.*}} decl
|
| 636 | // CHECK-NEXT: Function{{.*}}foo
|
| 637 |
|
| 638 | template class testDecl<nullptr>;
|
| 639 | // CHECK: ClassTemplateSpecializationDecl{{.*}} class testDecl
|
| 640 | // CHECK: TemplateArgument{{.*}} nullptr
|
| 641 |
|
| 642 | template<int> class testIntegral { };
|
| 643 | template class testIntegral<1>;
|
| 644 | // CHECK: ClassTemplateSpecializationDecl{{.*}} class testIntegral
|
| 645 | // CHECK: TemplateArgument{{.*}} integral 1
|
| 646 |
|
| 647 | template<template<typename> class> class testTemplate { };
|
| 648 | template class testTemplate<A>;
|
| 649 | // CHECK: ClassTemplateSpecializationDecl{{.*}} class testTemplate
|
| 650 | // CHECK: TemplateArgument{{.*}} A
|
| 651 |
|
| 652 | template<template<typename> class ...T> class C {
|
| 653 | B<T...> testTemplateExpansion;
|
| 654 | };
|
| 655 | // FIXME: Need TemplateSpecializationType dumping to test TemplateExpansion.
|
| 656 |
|
| 657 | template<int, int = 0> class testExpr;
|
| 658 | template<int I> class testExpr<I> { };
|
| 659 | // CHECK: ClassTemplatePartialSpecializationDecl{{.*}} class testExpr
|
| 660 | // CHECK: TemplateArgument{{.*}} expr
|
| 661 | // CHECK-NEXT: DeclRefExpr{{.*}}I
|
| 662 |
|
| 663 | template<int, int ...> class testPack { };
|
| 664 | template class testPack<0, 1, 2>;
|
| 665 | // CHECK: ClassTemplateSpecializationDecl{{.*}} class testPack
|
| 666 | // CHECK: TemplateArgument{{.*}} integral 0
|
| 667 | // CHECK-NEXT: TemplateArgument{{.*}} pack
|
| 668 | // CHECK-NEXT: TemplateArgument{{.*}} integral 1
|
| 669 | // CHECK-NEXT: TemplateArgument{{.*}} integral 2
|
| 670 | }
|
| 671 |
|
| 672 | namespace testUsingDecl {
|
| 673 | int i;
|
| 674 | }
|
| 675 | namespace TestUsingDecl {
|
| 676 | using testUsingDecl::i;
|
| 677 | }
|
| 678 | // CHECK: NamespaceDecl{{.*}} TestUsingDecl
|
| 679 | // CHECK-NEXT: UsingDecl{{.*}} testUsingDecl::i
|
| 680 | // CHECK-NEXT: UsingShadowDecl{{.*}} Var{{.*}} 'i' 'int'
|
| 681 |
|
| 682 | namespace testUnresolvedUsing {
|
| 683 | class A { };
|
| 684 | template<class T> class B {
|
| 685 | public:
|
| 686 | A a;
|
| 687 | };
|
| 688 | template<class T> class TestUnresolvedUsing : public B<T> {
|
| 689 | using typename B<T>::a;
|
| 690 | using B<T>::a;
|
| 691 | };
|
| 692 | }
|
| 693 | // CHECK: CXXRecordDecl{{.*}} TestUnresolvedUsing
|
| 694 | // CHECK: UnresolvedUsingTypenameDecl{{.*}} B<T>::a
|
| 695 | // CHECK: UnresolvedUsingValueDecl{{.*}} B<T>::a
|
| 696 |
|
| 697 | namespace TestLinkageSpecDecl {
|
| 698 | extern "C" void test1();
|
| 699 | extern "C++" void test2();
|
| 700 | }
|
| 701 | // CHECK: NamespaceDecl{{.*}} TestLinkageSpecDecl
|
| 702 | // CHECK-NEXT: LinkageSpecDecl{{.*}} C
|
| 703 | // CHECK-NEXT: FunctionDecl
|
| 704 | // CHECK-NEXT: LinkageSpecDecl{{.*}} C++
|
| 705 | // CHECK-NEXT: FunctionDecl
|
| 706 |
|
| 707 | class TestAccessSpecDecl {
|
| 708 | public:
|
| 709 | private:
|
| 710 | protected:
|
| 711 | };
|
| 712 | // CHECK: CXXRecordDecl{{.*}} class TestAccessSpecDecl
|
| 713 | // CHECK: CXXRecordDecl{{.*}} class TestAccessSpecDecl
|
| 714 | // CHECK-NEXT: AccessSpecDecl{{.*}} public
|
| 715 | // CHECK-NEXT: AccessSpecDecl{{.*}} private
|
| 716 | // CHECK-NEXT: AccessSpecDecl{{.*}} protected
|
| 717 |
|
| 718 | template<typename T> class TestFriendDecl {
|
| 719 | friend int foo();
|
| 720 | friend class A;
|
| 721 | friend T;
|
| 722 | };
|
| 723 | // CHECK: CXXRecord{{.*}} TestFriendDecl
|
| 724 | // CHECK: CXXRecord{{.*}} TestFriendDecl
|
| 725 | // CHECK-NEXT: FriendDecl
|
| 726 | // CHECK-NEXT: FunctionDecl{{.*}} foo
|
| 727 | // CHECK-NEXT: FriendDecl{{.*}} 'class A':'A'
|
| 728 | // CHECK-NEXT: FriendDecl{{.*}} 'T'
|
| 729 |
|
| 730 | namespace TestFileScopeAsmDecl {
|
| 731 | asm("ret");
|
| 732 | }
|
| 733 | // CHECK: NamespaceDecl{{.*}} TestFileScopeAsmDecl{{$}}
|
| 734 | // CHECK: FileScopeAsmDecl{{.*> .*$}}
|
| 735 | // CHECK-NEXT: StringLiteral
|
| 736 |
|
| 737 | namespace TestFriendDecl2 {
|
| 738 | void f();
|
| 739 | struct S {
|
| 740 | friend void f();
|
| 741 | };
|
| 742 | }
|
| 743 | // CHECK: NamespaceDecl [[TestFriendDecl2:0x.*]] <{{.*}}> {{.*}} TestFriendDecl2
|
| 744 | // CHECK: |-FunctionDecl [[TestFriendDecl2_f:0x.*]] <{{.*}}> {{.*}} f 'void ()'
|
| 745 | // CHECK: `-CXXRecordDecl {{.*}} struct S
|
| 746 | // CHECK: |-CXXRecordDecl {{.*}} struct S
|
| 747 | // CHECK: `-FriendDecl
|
| 748 | // CHECK: `-FunctionDecl {{.*}} parent [[TestFriendDecl2]] prev [[TestFriendDecl2_f]] <{{.*}}> {{.*}} f 'void ()'
|
| 749 |
|
| 750 | namespace Comment {
|
| 751 | extern int Test;
|
| 752 | /// Something here.
|
| 753 | extern int Test;
|
| 754 | extern int Test;
|
| 755 | }
|
| 756 |
|
| 757 | // CHECK: VarDecl {{.*}} Test 'int' extern
|
| 758 | // CHECK-NOT: FullComment
|
| 759 | // CHECK: VarDecl {{.*}} Test 'int' extern
|
| 760 | // CHECK: `-FullComment
|
| 761 | // CHECK: `-ParagraphComment
|
| 762 | // CHECK: `-TextComment
|
| 763 | // CHECK: VarDecl {{.*}} Test 'int' extern
|
| 764 | // CHECK-NOT: FullComment
|
| 765 | |