// Test without serialization: // RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown -ast-dump %s \ // RUN: | FileCheck -strict-whitespace %s // // Test with serialization: // RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown -emit-pch -o %t %s // RUN: %clang_cc1 -x c++ -std=c++17 -triple x86_64-unknown-unknown -include-pch %t -ast-dump-all /dev/null \ // RUN: | sed -e "s/ //" -e "s/ imported//" \ // RUN: | FileCheck --strict-whitespace %s template // CHECK: FunctionTemplateDecl 0x{{[^ ]*}} <{{.*}}:1, line:[[@LINE+2]]:10> col:6 a // CHECK-NEXT: TemplateTypeParmDecl 0x{{[^ ]*}} col:20 referenced typename depth 0 index 0 Ty void a(Ty); template // CHECK: FunctionTemplateDecl 0x{{[^ ]*}} col:6 b // CHECK-NEXT: TemplateTypeParmDecl 0x{{[^ ]*}} col:23 referenced typename depth 0 index 0 ... Ty void b(Ty...); template // CHECK: FunctionTemplateDecl 0x{{[^ ]*}} col:6 c // CHECK-NEXT: TemplateTypeParmDecl 0x{{[^ ]*}} col:20 referenced typename depth 0 index 0 Ty // CHECK-NEXT: TemplateTypeParmDecl 0x{{[^ ]*}} col:33 referenced typename depth 0 index 1 Uy void c(Ty, Uy); template <> void c(float, int); // CHECK: FunctionDecl 0x{{[^ ]*}} prev 0x{{[^ ]*}} col:6 c 'void (float, int)' // CHECK: TemplateArgument type 'float' // CHECK: TemplateArgument type 'int' template typename Uy> // CHECK: FunctionTemplateDecl 0x{{[^ ]*}} col:6 d // CHECK-NEXT: TemplateTypeParmDecl 0x{{[^ ]*}} col:20 referenced typename depth 0 index 0 Ty // CHECK-NEXT: TemplateTemplateParmDecl 0x{{[^ ]*}} col:52 depth 0 index 1 Uy // CHECK-NEXT: TemplateTypeParmDecl 0x{{[^ ]*}} col:41 typename depth 1 index 0 void d(Ty, Uy); template // CHECK: FunctionTemplateDecl 0x{{[^ ]*}} col:6 e // CHECK-NEXT: TemplateTypeParmDecl 0x{{[^ ]*}} col:17 referenced class depth 0 index 0 Ty void e(Ty); template // CHECK: FunctionTemplateDecl 0x{{[^ ]*}} col:6 f // CHECK-NEXT: NonTypeTemplateParmDecl 0x{{[^ ]*}} col:15 referenced 'int' depth 0 index 0 N void f(int i = N); template // CHECK: FunctionTemplateDecl 0x{{[^ ]*}} col:6 g // CHECK-NEXT: TemplateTypeParmDecl 0x{{[^ ]*}} col:20 referenced typename depth 0 index 0 Ty // CHECK-NEXT: TemplateArgument type 'int' void g(Ty); template // CHECK: FunctionTemplateDecl 0x{{[^ ]*}} col:6 h // CHECK-NEXT: TemplateTypeParmDecl 0x{{[^ ]*}} col:20 typename depth 0 index 0 // CHECK-NEXT: TemplateArgument type 'void' void h(); template // CHECK: ClassTemplateDecl 0x{{[^ ]*}} col:8 R // CHECK-NEXT: TemplateTypeParmDecl 0x{{[^ ]*}} col:20 typename depth 0 index 0 Ty // CHECK: ClassTemplateSpecialization 0x{{[^ ]*}} 'R' struct R {}; template <> // CHECK: ClassTemplateSpecializationDecl 0x{{[^ ]*}} col:8 struct R definition // CHECK: TemplateArgument type 'int' struct R {}; template // CHECK: ClassTemplateDecl 0x{{[^ ]*}} col:8 S // CHECK-NEXT: TemplateTypeParmDecl 0x{{[^ ]*}} col:20 typename depth 0 index 0 Ty // CHECK-NEXT: TemplateTypeParmDecl 0x{{[^ ]*}} col:30 class depth 0 index 1 Uy struct S {}; template // CHECK: ClassTemplatePartialSpecializationDecl 0x{{[^ ]*}} col:8 struct S definition // CHECK: TemplateArgument type 'type-parameter-0-0' // CHECK: TemplateArgument type 'int' // CHECK: TemplateTypeParmDecl 0x{{[^ ]*}} col:20 referenced typename depth 0 index 0 Ty struct S {}; template // CHECK: ClassTemplateDecl 0x{{[^ ]*}} col:8 T // CHECK-NEXT: NonTypeTemplateParmDecl 0x{{[^ ]*}} col:15 'auto' depth 0 index 0 struct T {}; template // CHECK: ClassTemplateDecl 0x{{[^ ]*}} col:8 U // CHECK-NEXT: NonTypeTemplateParmDecl 0x{{[^ ]*}} col:25 'decltype(auto)' depth 0 index 0 struct U {}; template // CHECK: ClassTemplateDecl 0x{{[^ ]*}} line:[[@LINE+2]]:8 V // CHECK-NEXT: TemplateTypeParmDecl 0x{{[^ ]*}} col:20 typename depth 0 index 0 Ty struct V { template // CHECK: FunctionTemplateDecl 0x{{[^ ]*}} col:8 f // CHECK-NEXT: TemplateTypeParmDecl 0x{{[^ ]*}} col:22 typename depth 1 index 0 Uy void f(); }; template template // CHECK: FunctionTemplateDecl 0x{{[^ ]*}} parent 0x{{[^ ]*}} prev 0x{{[^ ]*}} col:13 f // CHECK-NEXT: TemplateTypeParmDecl 0x{{[^ ]*}} col:20 typename depth 1 index 0 Uy void V::f() {} namespace PR55886 { template struct C { template using type1 = U(T); }; using type2 = typename C::type1; // CHECK: TypeAliasDecl 0x{{[^ ]*}} col:7 type2 'typename C::type1':'void (int)' // CHECK-NEXT: ElaboratedType 0x{{[^ ]*}} 'typename C::type1' sugar // CHECK-NEXT: TemplateSpecializationType 0x{{[^ ]*}} 'type1' sugar alias type1 // CHECK-NEXT: TemplateArgument type 'void' // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'void' // CHECK-NEXT: FunctionProtoType 0x{{[^ ]*}} 'void (int)' cdecl // CHECK-NEXT: SubstTemplateTypeParmType 0x{{[^ ]*}} 'void' sugar // CHECK-NEXT: TemplateTypeParmType 0x{{[^ ]*}} 'U' dependent depth 0 index 0 // CHECK-NEXT: TemplateTypeParm 0x{{[^ ]*}} 'U' // CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'void' // CHECK-NEXT: SubstTemplateTypeParmType 0x{{[^ ]*}} 'int' sugar // CHECK-NEXT: TemplateTypeParmType 0x{{[^ ]*}} 'T' dependent depth 0 index 0 } // namespace PR55886 namespace PR56099 { template struct Y; template using Z = Y; template struct foo { template using bind = Z; }; using t1 = foo::bind; // CHECK: TemplateSpecializationType 0x{{[^ ]*}} 'Y' sugar Y // CHECK: SubstTemplateTypeParmType 0x{{[^ ]*}} 'char' sugar // CHECK-NEXT: TemplateTypeParmType 0x{{[^ ]*}} 'Bs' dependent contains_unexpanded_pack depth 0 index 0 pack // CHECK: SubstTemplateTypeParmType 0x{{[^ ]*}} 'float' sugar // CHECK-NEXT: TemplateTypeParmType 0x{{[^ ]*}} 'Bs' dependent contains_unexpanded_pack depth 0 index 0 pack // CHECK: SubstTemplateTypeParmType 0x{{[^ ]*}} 'int' sugar // CHECK-NEXT: TemplateTypeParmType 0x{{[^ ]*}} 'Bs' dependent contains_unexpanded_pack depth 0 index 0 pack // CHECK: SubstTemplateTypeParmType 0x{{[^ ]*}} 'short' sugar // CHECK-NEXT: TemplateTypeParmType 0x{{[^ ]*}} 'Bs' dependent contains_unexpanded_pack depth 0 index 0 pack template struct D { template using B = int(int (*...p)(T, U)); }; using t2 = D::B; // CHECK: TemplateSpecializationType 0x{{[^ ]*}} 'B' sugar alias B // CHECK: FunctionProtoType 0x{{[^ ]*}} 'int (int (*)(float, int), int (*)(char, short))' cdecl // CHECK: FunctionProtoType 0x{{[^ ]*}} 'int (float, int)' cdecl // CHECK: SubstTemplateTypeParmType 0x{{[^ ]*}} 'float' sugar // CHECK-NEXT: TemplateTypeParmType 0x{{[^ ]*}} 'T' dependent contains_unexpanded_pack depth 0 index 0 pack // CHECK: SubstTemplateTypeParmType 0x{{[^ ]*}} 'int' sugar // CHECK-NEXT: TemplateTypeParmType 0x{{[^ ]*}} 'U' dependent contains_unexpanded_pack depth 0 index 0 pack // CHECK: FunctionProtoType 0x{{[^ ]*}} 'int (char, short)' cdecl // CHECK: SubstTemplateTypeParmType 0x{{[^ ]*}} 'char' sugar // CHECK-NEXT: TemplateTypeParmType 0x{{[^ ]*}} 'T' dependent contains_unexpanded_pack depth 0 index 0 pack // CHECK: SubstTemplateTypeParmType 0x{{[^ ]*}} 'short' sugar // CHECK-NEXT: TemplateTypeParmType 0x{{[^ ]*}} 'U' dependent contains_unexpanded_pack depth 0 index 0 pack } // namespace PR56099