[RISCV][FMV] Support target_clones (#85786)
[llvm-project.git] / clang / test / AST / ast-dump-using-template.cpp
blob75db5eb5a9d1cbe8b2c52196eec9adecde575d58
1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -std=c++17 -ast-dump %s | FileCheck -strict-whitespace %s
3 // Tests to verify we construct correct using template names.
4 // TemplateNames are not dumped, so the sugar here isn't obvious. However
5 // the "using" on the TemplateSpecializationTypes shows that the
6 // UsingTemplateName is present.
7 namespace ns {
8 template<typename T> class S {
9 public:
10 S(T);
12 template<typename T> struct S2 { S2(T); };
13 template <typename T> S2(T t) -> S2<T>;
15 using ns::S;
16 using ns::S2;
18 // TemplateName in TemplateSpecializationType.
19 template<typename T>
20 using A = S<T>;
21 // CHECK: TypeAliasDecl
22 // CHECK-NEXT: `-ElaboratedType {{.*}} 'S<T>' sugar dependent
23 // CHECK-NEXT: `-TemplateSpecializationType {{.*}} 'S<T>' dependent
24 // CHECK-NEXT: |-name: 'S':'ns::S' qualified
25 // CHECk-NEXT: | |-UsingShadowDecl {{.+}} ClassTemplate {{.+}} 'S'
27 // TemplateName in TemplateArgument.
28 template <template <typename> class T> class X {};
29 using B = X<S>;
30 // CHECK: TypeAliasDecl
31 // CHECK-NEXT: `-ElaboratedType {{.*}} 'X<S>' sugar
32 // CHECK-NEXT: `-TemplateSpecializationType {{.*}} 'X<S>' sugar
33 // CHECK-NEXT: |-name: 'X' qualified
34 // CHECK-NEXT: | `-ClassTemplateDecl {{.+}} X
35 // CHECK-NEXT: |-TemplateArgument template 'S':'ns::S' qualified
36 // CHECK-NEXT: | |-UsingShadowDecl {{.*}} implicit ClassTemplate {{.*}} 'S'
37 // CHECK-NEXT: | `-target: ClassTemplateDecl {{.*}} S
38 // CHECK-NEXT: `-RecordType {{.*}} 'X<ns::S>'
39 // CHECK-NEXT: `-ClassTemplateSpecialization {{.*}} 'X'
41 // TemplateName in DeducedTemplateSpecializationType.
42 S DeducedTemplateSpecializationT(123);
43 using C = decltype(DeducedTemplateSpecializationT);
44 // CHECK: DecltypeType {{.*}}
45 // CHECK-NEXT: |-DeclRefExpr {{.*}}
46 // CHECK-NEXT: `-ElaboratedType {{.*}} 'S<int>' sugar
47 // CHECK-NEXT: `-DeducedTemplateSpecializationType {{.*}} 'ns::S<int>' sugar
48 // CHECK-NEXT: |-name: 'S':'ns::S' qualified
49 // CHECK-NEXT: | |-UsingShadowDecl {{.+}} 'S'
51 S2 DeducedTemplateSpecializationT2(123);
52 using D = decltype(DeducedTemplateSpecializationT2);
53 // CHECK: DecltypeType {{.*}}
54 // CHECK-NEXT: |-DeclRefExpr {{.*}}
55 // CHECK-NEXT: `-ElaboratedType {{.*}} 'S2<int>' sugar
56 // CHECK-NEXT: `-DeducedTemplateSpecializationType {{.*}} 'S2<int>' sugar
57 // CHECK-NEXT: |-name: 'S2':'ns::S2' qualified
58 //CHECk-NEXT: | |-UsingShadowDecl {{.+}} ClassTemplate {{.+}} 'S2'