brintos

brintos / llvm-project-archived public Read only

0
0
Text · 60.5 KiB · f9ee3ab Raw
1008 lines · cpp
1// Test without serialization:2// RUN: %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -fms-extensions \3// RUN: -ast-dump -ast-dump-filter Test %s \4// RUN: | FileCheck --strict-whitespace %s5//6// Test with serialization: FIXME: Find why the outputs differs and fix it!7//    : %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -fms-extensions -emit-pch -o %t %s8//    : %clang_cc1 -x c++ -std=c++11 -triple x86_64-linux-gnu -fms-extensions -include-pch %t \9//    : -ast-dump-all -ast-dump-filter Test /dev/null \10//    : | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \11//    : | FileCheck --strict-whitespace %s12 13class testEnumDecl {14  enum class TestEnumDeclScoped;15  enum TestEnumDeclFixed : int;16};17// CHECK: EnumDecl{{.*}} class TestEnumDeclScoped 'int'18// CHECK-NOT: instantiated_from19// CHECK: EnumDecl{{.*}} TestEnumDeclFixed 'int'20// CHECK-NOT: instantiated_from21 22class testFieldDecl {23  int TestFieldDeclInit = 0;24};25// CHECK:      FieldDecl{{.*}} TestFieldDeclInit 'int'26// CHECK-NEXT:   IntegerLiteral27 28namespace testVarDeclNRVO {29  class A { };30  A TestFuncNRVO() {31    A TestVarDeclNRVO;32    return TestVarDeclNRVO;33  }34}35// CHECK:      FunctionDecl{{.*}} TestFuncNRVO 'A ()'36// CHECK-NEXT: `-CompoundStmt37// CHECK-NEXT: |-DeclStmt38// CHECK-NEXT: | `-VarDecl{{.*}} TestVarDeclNRVO 'A' nrvo callinit39// CHECK-NEXT: |   `-CXXConstructExpr40// CHECK-NEXT: `-ReturnStmt{{.*}} nrvo_candidate(Var {{.*}} 'TestVarDeclNRVO' 'A')41 42void testParmVarDeclInit(int TestParmVarDeclInit = 0);43// CHECK:      ParmVarDecl{{.*}} TestParmVarDeclInit 'int'44// CHECK-NEXT:   IntegerLiteral{{.*}}45 46namespace TestNamespaceDecl {47  int i;48}49// CHECK:      NamespaceDecl{{.*}} TestNamespaceDecl50// CHECK-NEXT:   VarDecl51 52namespace TestNamespaceDecl {53  int j;54}55// CHECK:      NamespaceDecl{{.*}} TestNamespaceDecl56// CHECK-NEXT:   original Namespace57// CHECK-NEXT:   VarDecl58 59inline namespace TestNamespaceDeclInline {60}61// CHECK:      NamespaceDecl{{.*}} TestNamespaceDeclInline inline62 63namespace TestNestedNameSpace::Nested {64}65// CHECK:      NamespaceDecl{{.*}} TestNestedNameSpace66// CHECK:      NamespaceDecl{{.*}} Nested nested{{\s*$}}67 68namespace TestMultipleNested::SecondLevelNested::Nested {69}70// CHECK:      NamespaceDecl{{.*}} TestMultipleNested71// CHECK:      NamespaceDecl{{.*}} SecondLevelNested nested72// CHECK:      NamespaceDecl{{.*}} Nested nested{{\s*$}}73 74namespace TestInlineNested::inline SecondLevel::inline Nested {75}76// CHECK:      NamespaceDecl{{.*}} TestInlineNested77// CHECK:      NamespaceDecl{{.*}} SecondLevel inline nested78// CHECK:      NamespaceDecl{{.*}} Nested inline nested{{\s*$}}79 80namespace testUsingDirectiveDecl {81  namespace A {82  }83}84namespace TestUsingDirectiveDecl {85  using namespace testUsingDirectiveDecl::A;86}87// CHECK:      NamespaceDecl{{.*}} TestUsingDirectiveDecl88// CHECK-NEXT:   UsingDirectiveDecl{{.*}} Namespace{{.*}} 'A'89 90namespace testNamespaceAlias {91  namespace A {92  }93}94namespace TestNamespaceAlias = testNamespaceAlias::A;95// CHECK:      NamespaceAliasDecl{{.*}} TestNamespaceAlias96// CHECK-NEXT:   Namespace{{.*}} 'A'97 98using TestTypeAliasDecl = int;99// CHECK: TypeAliasDecl{{.*}} TestTypeAliasDecl 'int'100 101namespace testTypeAliasTemplateDecl {102  template<typename T> class A;103  template<typename T> using TestTypeAliasTemplateDecl = A<T>;104}105// CHECK:      TypeAliasTemplateDecl{{.*}} TestTypeAliasTemplateDecl106// CHECK-NEXT:   TemplateTypeParmDecl107// CHECK-NEXT:   TypeAliasDecl{{.*}} TestTypeAliasTemplateDecl 'A<T>'108 109namespace testCXXRecordDecl {110  class TestEmpty {};111// CHECK:      CXXRecordDecl{{.*}} class TestEmpty112// CHECK-NEXT:   DefinitionData pass_in_registers empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init113// CHECK-NEXT:     DefaultConstructor exists trivial constexpr114// CHECK-NEXT:     CopyConstructor simple trivial has_const_param115// CHECK-NEXT:     MoveConstructor exists simple trivial116// CHECK-NEXT:     CopyAssignment simple trivial has_const_param117// CHECK-NEXT:     MoveAssignment exists simple trivial118// CHECK-NEXT:     Destructor simple irrelevant trivial119 120  class A { };121  class B { };122  class TestCXXRecordDecl : virtual A, public B {123    int i;124  };125}126// CHECK:      CXXRecordDecl{{.*}} class TestCXXRecordDecl127// CHECK-NEXT:   DefinitionData{{$}}128// CHECK-NEXT:     DefaultConstructor exists non_trivial129// CHECK-NEXT:     CopyConstructor simple non_trivial has_const_param130// CHECK-NEXT:     MoveConstructor exists simple non_trivial131// CHECK-NEXT:     CopyAssignment simple non_trivial has_const_param132// CHECK-NEXT:     MoveAssignment exists simple non_trivial133// CHECK-NEXT:     Destructor simple irrelevant trivial134// CHECK-NEXT:   virtual private 'A'135// CHECK-NEXT:   public 'B'136// CHECK-NEXT:   CXXRecordDecl{{.*}} class TestCXXRecordDecl137// CHECK-NEXT:   FieldDecl138 139template<class...T>140class TestCXXRecordDeclPack : public T... {141};142// CHECK:      CXXRecordDecl{{.*}} class TestCXXRecordDeclPack143// CHECK:        public 'T'...144// CHECK-NEXT:   CXXRecordDecl{{.*}} class TestCXXRecordDeclPack145 146thread_local int TestThreadLocalInt;147// CHECK: TestThreadLocalInt {{.*}} tls_dynamic148 149class testCXXMethodDecl {150  virtual void TestCXXMethodDeclPure() = 0;151  void TestCXXMethodDeclDelete() = delete;152  void TestCXXMethodDeclThrow() throw();153  void TestCXXMethodDeclThrowType() throw(int);154};155// CHECK: CXXMethodDecl{{.*}} TestCXXMethodDeclPure 'void ()' virtual pure156// CHECK: CXXMethodDecl{{.*}} TestCXXMethodDeclDelete 'void ()' delete157// CHECK: CXXMethodDecl{{.*}} TestCXXMethodDeclThrow 'void () throw()'158// CHECK: CXXMethodDecl{{.*}} TestCXXMethodDeclThrowType 'void () throw(int)'159 160namespace testCXXConstructorDecl {161  class A { };162  class TestCXXConstructorDecl : public A {163    int I;164    TestCXXConstructorDecl(A &a, int i) : A(a), I(i) { }165    TestCXXConstructorDecl(A &a) : TestCXXConstructorDecl(a, 0) { }166  };167}168// CHECK:      CXXConstructorDecl{{.*}} TestCXXConstructorDecl 'void {{.*}}'169// CHECK-NEXT:   ParmVarDecl{{.*}} a170// CHECK-NEXT:   ParmVarDecl{{.*}} i171// CHECK-NEXT:   CXXCtorInitializer{{.*}}A172// CHECK-NEXT:     Expr173// CHECK:        CXXCtorInitializer{{.*}}I174// CHECK-NEXT:     Expr175// CHECK:        CompoundStmt176// CHECK:      CXXConstructorDecl{{.*}} TestCXXConstructorDecl 'void {{.*}}'177// CHECK-NEXT:   ParmVarDecl{{.*}} a178// CHECK-NEXT:   CXXCtorInitializer{{.*}}TestCXXConstructorDecl179// CHECK-NEXT:     CXXConstructExpr{{.*}}TestCXXConstructorDecl180 181class TestCXXDestructorDecl {182  ~TestCXXDestructorDecl() { }183};184// CHECK:      CXXDestructorDecl{{.*}} ~TestCXXDestructorDecl 'void () noexcept'185// CHECK-NEXT:   CompoundStmt186 187// Test that the range of a defaulted members is computed correctly.188class TestMemberRanges {189public:190  TestMemberRanges() = default;191  TestMemberRanges(const TestMemberRanges &Other) = default;192  TestMemberRanges(TestMemberRanges &&Other) = default;193  ~TestMemberRanges() = default;194  TestMemberRanges &operator=(const TestMemberRanges &Other) = default;195  TestMemberRanges &operator=(TestMemberRanges &&Other) = default;196};197void SomeFunction() {198  TestMemberRanges A;199  TestMemberRanges B(A);200  B = A;201  A = static_cast<TestMemberRanges &&>(B);202  TestMemberRanges C(static_cast<TestMemberRanges &&>(A));203}204// CHECK:      CXXConstructorDecl{{.*}} <line:{{.*}}:3, col:30>205// CHECK:      CXXConstructorDecl{{.*}} <line:{{.*}}:3, col:59>206// CHECK:      CXXConstructorDecl{{.*}} <line:{{.*}}:3, col:54>207// CHECK:      CXXDestructorDecl{{.*}} <line:{{.*}}:3, col:31>208// CHECK:      CXXMethodDecl{{.*}} <line:{{.*}}:3, col:70>209// CHECK:      CXXMethodDecl{{.*}} <line:{{.*}}:3, col:65>210 211class TestCXXConversionDecl {212  operator int() { return 0; }213};214// CHECK:      CXXConversionDecl{{.*}} operator int 'int ()'215// CHECK-NEXT:   CompoundStmt216 217namespace TestStaticAssertDecl {218  static_assert(true, "msg");219}220// CHECK:      NamespaceDecl{{.*}} TestStaticAssertDecl221// CHECK-NEXT:   StaticAssertDecl{{.*> .*$}}222// CHECK-NEXT:     CXXBoolLiteralExpr223// CHECK-NEXT:     StringLiteral224 225namespace testFunctionTemplateDecl {226  class A { };227  class B { };228  class C { };229  class D { };230  template<typename T> void TestFunctionTemplate(T) { }231 232  // implicit instantiation233  void bar(A a) { TestFunctionTemplate(a); }234 235  // explicit specialization236  template<> void TestFunctionTemplate(B);237 238  // explicit instantiation declaration239  extern template void TestFunctionTemplate(C);240 241  // explicit instantiation definition242  template void TestFunctionTemplate(D);243}244  // CHECK:       FunctionTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-14]]:3, col:55> col:29 TestFunctionTemplate245  // CHECK-NEXT:  |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 referenced typename depth 0 index 0 T246  // CHECK-NEXT:  |-FunctionDecl 0x{{.+}} <col:24, col:55> col:29 TestFunctionTemplate 'void (T)'247  // CHECK-NEXT:  | |-ParmVarDecl 0x{{.+}} <col:50> col:51 'T'248  // CHECK-NEXT:  | `-CompoundStmt 0x{{.+}} <col:53, col:55>249  // CHECK-NEXT:  |-FunctionDecl 0x{{.+}} <col:24, col:55> col:29 used TestFunctionTemplate 'void (testFunctionTemplateDecl::A)'250  // CHECK-NEXT:  | |-TemplateArgument type 'testFunctionTemplateDecl::A'251  // CHECK-NEXT:  | | `-RecordType 0{{.+}} 'testFunctionTemplateDecl::A'252  // CHECK-NEXT:  | |   `-CXXRecord 0x{{.+}} 'A'253  // CHECK-NEXT:  | |-ParmVarDecl 0x{{.+}} <col:50> col:51 'testFunctionTemplateDecl::A'254  // CHECK-NEXT:  | `-CompoundStmt 0x{{.+}} <col:53, col:55>255  // CHECK-NEXT:  |-Function 0x{{.+}} 'TestFunctionTemplate' 'void (B)'256  // CHECK-NEXT:  |-FunctionDecl 0x{{.+}} <col:24, col:55> col:29 TestFunctionTemplate 'void (testFunctionTemplateDecl::C)'257  // CHECK-NEXT:  | |-TemplateArgument type 'testFunctionTemplateDecl::C'258  // CHECK-NEXT:  | | `-RecordType 0{{.+}} 'testFunctionTemplateDecl::C'259  // CHECK-NEXT:  | |   `-CXXRecord 0x{{.+}} 'C'260  // CHECK-NEXT:  | `-ParmVarDecl 0x{{.+}} <col:50> col:51 'testFunctionTemplateDecl::C'261  // CHECK-NEXT:  `-FunctionDecl 0x{{.+}} <col:24, col:55> col:29 TestFunctionTemplate 'void (testFunctionTemplateDecl::D)'262  // CHECK-NEXT:    |-TemplateArgument type 'testFunctionTemplateDecl::D'263  // CHECK-NEXT:    | `-RecordType 0{{.+}} 'testFunctionTemplateDecl::D'264  // CHECK-NEXT:    |   `-CXXRecord 0x{{.+}} 'D'265  // CHECK-NEXT:    |-ParmVarDecl 0x{{.+}} <col:50> col:51 'testFunctionTemplateDecl::D'266  // CHECK-NEXT:    `-CompoundStmt 0x{{.+}} <col:53, col:55>267 268  // CHECK:       FunctionDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-32]]:3, col:41> col:19 TestFunctionTemplate 'void (B)'269  // CHECK-NEXT:  |-TemplateArgument type 'testFunctionTemplateDecl::B'270  // CHECK-NEXT:  | `-RecordType 0{{.+}} 'testFunctionTemplateDecl::B'271  // CHECK-NEXT:  |   `-CXXRecord 0x{{.+}} 'B'272  // CHECK-NEXT:  `-ParmVarDecl 0x{{.+}} <col:40> col:41 'B'273 274 275namespace testClassTemplateDecl {276  class A { };277  class B { };278  class C { };279  class D { };280 281  template<typename T> class TestClassTemplate {282  public:283    TestClassTemplate();284    ~TestClassTemplate();285    int j();286    int i;287  };288 289  // implicit instantiation290  TestClassTemplate<A> a;291 292  // explicit specialization293  template<> class TestClassTemplate<B> {294    int j;295  };296 297  // explicit instantiation declaration298  extern template class TestClassTemplate<C>;299 300  // explicit instantiation definition301  template class TestClassTemplate<D>;302 303  // partial explicit specialization304  template<typename T1, typename T2> class TestClassTemplatePartial {305    int i;306  };307  template<typename T1> class TestClassTemplatePartial<T1, A> {308    int j;309  };310 311  template<typename T = int> struct TestTemplateDefaultType;312  template<typename T> struct TestTemplateDefaultType { };313 314  template<int I = 42> struct TestTemplateDefaultNonType;315  template<int I> struct TestTemplateDefaultNonType { };316 317  template<template<typename> class TT = TestClassTemplate> struct TestTemplateTemplateDefaultType;318  template<template<typename> class TT> struct TestTemplateTemplateDefaultType { };319}320 321// CHECK:       ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-40]]:3, line:[[@LINE-34]]:3> line:[[@LINE-40]]:30 TestClassTemplate{{$}}322// CHECK-NEXT:  |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T{{$}}323// CHECK-NEXT:  |-CXXRecordDecl 0x{{.+}} <col:24, line:[[@LINE-36]]:3> line:[[@LINE-42]]:30 class TestClassTemplate definition{{$}}324// CHECK-NEXT:  | |-DefinitionData standard_layout has_user_declared_ctor can_const_default_init{{$}}325// CHECK-NEXT:  | | |-DefaultConstructor exists non_trivial user_provided{{$}}326// CHECK-NEXT:  | | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param{{$}}327// CHECK-NEXT:  | | |-MoveConstructor{{$}}328// CHECK-NEXT:  | | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param{{$}}329// CHECK-NEXT:  | | |-MoveAssignment{{$}}330// CHECK-NEXT:  | | `-Destructor irrelevant non_trivial user_declared{{$}}331// CHECK-NEXT:  | |-CXXRecordDecl 0x{{.+}} <col:24, col:30> col:30 implicit referenced class TestClassTemplate{{$}}332// CHECK-NEXT:  | |-AccessSpecDecl 0x{{.+}} <line:[[@LINE-50]]:3, col:9> col:3 public{{$}}333// CHECK-NEXT:  | |-CXXConstructorDecl 0x[[#%x,TEMPLATE_CONSTRUCTOR_DECL:]] <line:[[@LINE-50]]:5, col:23> col:5 TestClassTemplate<T> 'void ()'{{$}}334// CHECK-NEXT:  | |-CXXDestructorDecl 0x[[#%x,TEMPLATE_DESTRUCTOR_DECL:]] <line:[[@LINE-50]]:5, col:24> col:5 ~TestClassTemplate<T> 'void ()' not_selected{{$}}335// CHECK-NEXT:  | |-CXXMethodDecl 0x[[#%x,TEMPLATE_METHOD_DECL:]] <line:[[@LINE-50]]:5, col:11> col:9 j 'int ()'{{$}}336// CHECK-NEXT:  | `-FieldDecl 0x{{.+}} <line:[[@LINE-50]]:5, col:9> col:9 i 'int'{{$}}337// CHECK-NEXT:  |-ClassTemplateSpecializationDecl 0x{{.+}} <line:[[@LINE-56]]:3, line:[[@LINE-50]]:3> line:[[@LINE-56]]:30 class TestClassTemplate definition instantiated_from 0x{{.+}} implicit_instantiation{{$}}338// CHECK-NEXT:  | |-DefinitionData standard_layout has_user_declared_ctor can_const_default_init{{$}}339// CHECK-NEXT:  | | |-DefaultConstructor exists non_trivial user_provided{{$}}340// CHECK-NEXT:  | | |-CopyConstructor simple trivial has_const_param implicit_has_const_param{{$}}341// CHECK-NEXT:  | | |-MoveConstructor{{$}}342// CHECK-NEXT:  | | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param{{$}}343// CHECK-NEXT:  | | |-MoveAssignment{{$}}344// CHECK-NEXT:  | | `-Destructor non_trivial user_declared{{$}}345// CHECK-NEXT:  | |-TemplateArgument type 'testClassTemplateDecl::A'{{$}}346// CHECK-NEXT:  | | `-RecordType 0{{.+}} 'testClassTemplateDecl::A' canonical{{$}}347// CHECK-NEXT:  | |   `-CXXRecord 0x{{.+}} 'A'{{$}}348// CHECK-NEXT:  | |-CXXRecordDecl 0x{{.+}} <col:24, col:30> col:30 implicit class TestClassTemplate{{$}}349// CHECK-NEXT:  | |-AccessSpecDecl 0x{{.+}} <line:[[@LINE-67]]:3, col:9> col:3 public{{$}}350// CHECK-NEXT:  | |-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-67]]:5, col:23> col:5 used TestClassTemplate 'void ()' implicit_instantiation instantiated_from 0x[[#TEMPLATE_CONSTRUCTOR_DECL]]{{$}}351// CHECK-NEXT:  | |-CXXDestructorDecl 0x{{.+}} <line:[[@LINE-67]]:5, col:24> col:5 used ~TestClassTemplate 'void () noexcept' implicit_instantiation instantiated_from 0x[[#TEMPLATE_DESTRUCTOR_DECL]]{{$}}352// CHECK-NEXT:  | |-CXXMethodDecl 0x{{.+}} <line:[[@LINE-67]]:5, col:11> col:9 j 'int ()' implicit_instantiation instantiated_from 0x[[#TEMPLATE_METHOD_DECL]]{{$}}353// CHECK-NEXT:  | |-FieldDecl 0x{{.+}} <line:[[@LINE-67]]:5, col:9> col:9 i 'int'{{$}}354// CHECK-NEXT:  | `-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-73]]:30> col:30 implicit constexpr TestClassTemplate 'void (const TestClassTemplate<testClassTemplateDecl::A> &)' inline default trivial noexcept-unevaluated 0x{{.+}}{{$}}355// CHECK-NEXT:  |   `-ParmVarDecl 0x{{.+}} <col:30> col:30 'const TestClassTemplate<testClassTemplateDecl::A> &'{{$}}356// CHECK-NEXT:  |-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate'{{$}}357// CHECK-NEXT:  |-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate'{{$}}358// CHECK-NEXT:  `-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate'{{$}}359 360// CHECK:       ClassTemplateSpecializationDecl 0x{{.+}} <{{.+}}:[[@LINE-67]]:3, line:[[@LINE-65]]:3> line:[[@LINE-67]]:20 class TestClassTemplate definition explicit_specialization{{$}}361// CHECK-NEXT:  |-DefinitionData pass_in_registers standard_layout trivially_copyable trivial literal{{$}}362// CHECK-NEXT:  | |-DefaultConstructor exists trivial needs_implicit{{$}}363// CHECK-NEXT:  | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param{{$}}364// CHECK-NEXT:  | |-MoveConstructor exists simple trivial needs_implicit{{$}}365// CHECK-NEXT:  | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param{{$}}366// CHECK-NEXT:  | |-MoveAssignment exists simple trivial needs_implicit{{$}}367// CHECK-NEXT:  | `-Destructor simple irrelevant trivial needs_implicit{{$}}368// CHECK-NEXT:  |-TemplateArgument type 'testClassTemplateDecl::B'{{$}}369// CHECK-NEXT:  | `-RecordType 0{{.+}} 'testClassTemplateDecl::B' canonical{{$}}370// CHECK-NEXT:  |   `-CXXRecord 0x{{.+}} 'B'{{$}}371// CHECK-NEXT:  |-CXXRecordDecl 0x{{.+}} <col:14, col:20> col:20 implicit class TestClassTemplate{{$}}372// CHECK-NEXT:  `-FieldDecl 0x{{.+}} <line:[[@LINE-78]]:5, col:9> col:9 j 'int'{{$}}373 374// CHECK:       ClassTemplateSpecializationDecl 0x{{.+}} <{{.+}}:{{.*}}:3, col:44> col:25 class TestClassTemplate definition instantiated_from 0x{{.+}} explicit_instantiation_declaration{{$}}375// CHECK-NEXT:  |-DefinitionData standard_layout has_user_declared_ctor can_const_default_init{{$}}376// CHECK-NEXT:  | |-DefaultConstructor exists non_trivial user_provided{{$}}377// CHECK-NEXT:  | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param{{$}}378// CHECK-NEXT:  | |-MoveConstructor{{$}}379// CHECK-NEXT:  | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param{{$}}380// CHECK-NEXT:  | |-MoveAssignment{{$}}381// CHECK-NEXT:  | `-Destructor non_trivial user_declared{{$}}382// CHECK-NEXT:  |-TemplateArgument type 'testClassTemplateDecl::C'{{$}}383// CHECK-NEXT:  | `-RecordType 0{{.+}} 'testClassTemplateDecl::C' canonical{{$}}384// CHECK-NEXT:  |   `-CXXRecord 0x{{.+}} 'C'{{$}}385// CHECK-NEXT:  |-CXXRecordDecl 0x{{.+}} <line:[[@LINE-104]]:24, col:30> col:30 implicit class TestClassTemplate{{$}}386// CHECK-NEXT:  |-AccessSpecDecl 0x{{.+}} <line:[[@LINE-104]]:3, col:9> col:3 public{{$}}387// CHECK-NEXT:  |-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-104]]:5, col:23> col:5 TestClassTemplate 'void ()' explicit_instantiation_declaration instantiated_from {{0x[^ ]+}}{{$}}388// CHECK-NEXT:  |-CXXDestructorDecl 0x{{.+}} <line:[[@LINE-104]]:5, col:24> col:5 ~TestClassTemplate 'void ()' explicit_instantiation_declaration noexcept-unevaluated 0x{{[^ ]+}} instantiated_from {{0x[^ ]+}}389// CHECK-NEXT:  |-CXXMethodDecl 0x{{.+}} <line:[[@LINE-104]]:5, col:11> col:9 j 'int ()' explicit_instantiation_declaration instantiated_from {{0x[^ ]+}}{{$}}390// CHECK-NEXT:  `-FieldDecl 0x{{.+}} <line:[[@LINE-104]]:5, col:9> col:9 i 'int'{{$}}391 392// CHECK:       ClassTemplateSpecializationDecl 0x{{.+}} <{{.+}}:[[@LINE-91]]:3, col:37> col:18 class TestClassTemplate definition instantiated_from 0x{{.+}} explicit_instantiation_definition{{$}}393// CHECK-NEXT:  |-DefinitionData standard_layout has_user_declared_ctor can_const_default_init{{$}}394// CHECK-NEXT:  | |-DefaultConstructor exists non_trivial user_provided{{$}}395// CHECK-NEXT:  | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param{{$}}396// CHECK-NEXT:  | |-MoveConstructor{{$}}397// CHECK-NEXT:  | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param{{$}}398// CHECK-NEXT:  | |-MoveAssignment{{$}}399// CHECK-NEXT:  | `-Destructor non_trivial user_declared{{$}}400// CHECK-NEXT:  |-TemplateArgument type 'testClassTemplateDecl::D'{{$}}401// CHECK-NEXT:  | `-RecordType 0{{.+}} 'testClassTemplateDecl::D' canonical{{$}}402// CHECK-NEXT:  |   `-CXXRecord 0x{{.+}} 'D'{{$}}403// CHECK-NEXT:  |-CXXRecordDecl 0x{{.+}} <line:[[@LINE-122]]:24, col:30> col:30 implicit class TestClassTemplate{{$}}404// CHECK-NEXT:  |-AccessSpecDecl 0x{{.+}} <line:[[@LINE-122]]:3, col:9> col:3 public{{$}}405// CHECK-NEXT:  |-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-122]]:5, col:23> col:5 TestClassTemplate 'void ()' implicit_instantiation instantiated_from {{0x[^ ]+}}{{$}}406// CHECK-NEXT:  |-CXXDestructorDecl 0x{{.+}} <line:[[@LINE-122]]:5, col:24> col:5 ~TestClassTemplate 'void ()' implicit_instantiation noexcept-unevaluated 0x{{.+}} instantiated_from {{0x[^ ]+}}{{$}}407// CHECK-NEXT:  |-CXXMethodDecl 0x{{.+}} <line:[[@LINE-122]]:5, col:11> col:9 j 'int ()' implicit_instantiation instantiated_from {{0x[^ ]+}}{{$}}408// CHECK-NEXT:  `-FieldDecl 0x{{.+}} <line:[[@LINE-122]]:5, col:9> col:9 i 'int'{{$}}409 410// CHECK:      ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-106]]:3, line:[[@LINE-104]]:3> line:[[@LINE-106]]:44 TestClassTemplatePartial{{$}}411// CHECK-NEXT:  |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T1{{$}}412// CHECK-NEXT:  |-TemplateTypeParmDecl 0x{{.+}} <col:25, col:34> col:34 typename depth 0 index 1 T2{{$}}413// CHECK-NEXT:  `-CXXRecordDecl 0x{{.+}} <col:38, line:[[@LINE-107]]:3> line:[[@LINE-109]]:44 class TestClassTemplatePartial definition{{$}}414// CHECK-NEXT:    |-DefinitionData standard_layout trivially_copyable trivial literal{{$}}415// CHECK-NEXT:    | |-DefaultConstructor exists trivial needs_implicit{{$}}416// CHECK-NEXT:    | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param{{$}}417// CHECK-NEXT:    | |-MoveConstructor exists simple trivial needs_implicit{{$}}418// CHECK-NEXT:    | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param{{$}}419// CHECK-NEXT:    | |-MoveAssignment exists simple trivial needs_implicit{{$}}420// CHECK-NEXT:    | `-Destructor simple irrelevant trivial needs_implicit{{$}}421// CHECK-NEXT:    |-CXXRecordDecl 0x{{.+}} <col:38, col:44> col:44 implicit class TestClassTemplatePartial{{$}}422// CHECK-NEXT:    `-FieldDecl 0x{{.+}} <line:[[@LINE-117]]:5, col:9> col:9 i 'int'{{$}}423 424// CHECK:       ClassTemplatePartialSpecializationDecl 0x{{.+}} <{{.+}}:[[@LINE-117]]:3, line:[[@LINE-115]]:3> line:[[@LINE-117]]:31 class TestClassTemplatePartial definition explicit_specialization{{$}}425// CHECK-NEXT:  |-DefinitionData standard_layout trivially_copyable trivial literal{{$}}426// CHECK-NEXT:  | |-DefaultConstructor exists trivial needs_implicit{{$}}427// CHECK-NEXT:  | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param{{$}}428// CHECK-NEXT:  | |-MoveConstructor exists simple trivial needs_implicit{{$}}429// CHECK-NEXT:  | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param{{$}}430// CHECK-NEXT:  | |-MoveAssignment exists simple trivial needs_implicit{{$}}431// CHECK-NEXT:  | `-Destructor simple irrelevant trivial needs_implicit{{$}}432// CHECK-NEXT:  |-TemplateArgument type 'type-parameter-0-0'{{$}}433// CHECK-NEXT:  | `-TemplateTypeParmType 0x{{.+}} 'type-parameter-0-0' dependent depth 0 index 0{{$}}434// CHECK-NEXT:  |-TemplateArgument type 'testClassTemplateDecl::A'{{$}}435// CHECK-NEXT:  | `-RecordType 0x{{.+}} 'testClassTemplateDecl::A' canonical{{$}}436// CHECK-NEXT:  |   `-CXXRecord 0x{{.+}} 'A'{{$}}437// CHECK-NEXT:  |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 referenced typename depth 0 index 0 T1{{$}}438// CHECK-NEXT:  |-CXXRecordDecl 0x{{.+}} <col:25, col:31> col:31 implicit class TestClassTemplatePartial{{$}}439// CHECK-NEXT:  `-FieldDecl 0x{{.+}} <line:[[@LINE-131]]:5, col:9> col:9 j 'int'{{$}}440 441// CHECK:       ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-130]]:3, col:37> col:37 TestTemplateDefaultType{{$}}442// CHECK-NEXT:  |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:25> col:21 typename depth 0 index 0 T{{$}}443// CHECK-NEXT:  | `-TemplateArgument type 'int'{{$}}444// CHECK-NEXT:  |   `-BuiltinType 0x{{.+}} 'int'{{$}}445// CHECK-NEXT:  `-CXXRecordDecl 0x{{.+}} <col:30, col:37> col:37 struct TestTemplateDefaultType{{$}}446 447// CHECK:       ClassTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-135]]:3, col:57> col:31 TestTemplateDefaultType{{$}}448// CHECK-NEXT:  |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T{{$}}449// CHECK-NEXT:  | `-TemplateArgument type 'int'{{$}}450// CHECK-NEXT:  |   |-inherited from TemplateTypeParm 0x{{.+}} 'T'{{$}}451// CHECK-NEXT:  |   `-BuiltinType 0x{{.+}} 'int'{{$}}452// CHECK-NEXT:  `-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <col:24, col:57> col:31 struct TestTemplateDefaultType definition{{$}}453// CHECK-NEXT:    |-DefinitionData empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init{{$}}454// CHECK-NEXT:    | |-DefaultConstructor exists trivial constexpr needs_implicit defaulted_is_constexpr{{$}}455// CHECK-NEXT:    | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param{{$}}456// CHECK-NEXT:    | |-MoveConstructor exists simple trivial needs_implicit{{$}}457// CHECK-NEXT:    | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param{{$}}458// CHECK-NEXT:    | |-MoveAssignment exists simple trivial needs_implicit{{$}}459// CHECK-NEXT:    | `-Destructor simple irrelevant trivial needs_implicit{{$}}460// CHECK-NEXT:    `-CXXRecordDecl 0x{{.+}} <col:24, col:31> col:31 implicit struct TestTemplateDefaultType{{$}}461 462// CHECK:       ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-148]]:3, col:31> col:31 TestTemplateDefaultNonType{{$}}463// CHECK-NEXT:  |-NonTypeTemplateParmDecl 0x{{.+}} <col:12, col:20> col:16 'int' depth 0 index 0 I{{$}}464// CHECK-NEXT:  | `-TemplateArgument <col:20> expr '42'{{$}}465// CHECK-NEXT:  |   `-IntegerLiteral 0x{{.+}} <col:20> 'int' 42{{$}}466// CHECK-NEXT:  `-CXXRecordDecl 0x{{.+}} <col:24, col:31> col:31 struct TestTemplateDefaultNonType{{$}}467 468// CHECK:       ClassTemplateDecl 0x{{.+}} <{{.+}}:{{.*}}:3, col:68> col:68 TestTemplateTemplateDefaultType{{$}}469// CHECK-NEXT:  |-TemplateTemplateParmDecl 0x{{.+}} <col:12, col:42> col:37 depth 0 index 0 TT{{$}}470// CHECK-NEXT:  | |-TemplateTypeParmDecl 0x{{.+}} <col:21> col:29 typename depth 1 index 0{{$}}471// CHECK-NEXT:  | `-TemplateArgument <col:42> template 'TestClassTemplate':'testClassTemplateDecl::TestClassTemplate' qualified{{$}}472// CHECK-NEXT:  |   `-ClassTemplateDecl 0x{{.+}} <line:{{.+}}:3, line:{{.+}}:3> line:{{.+}}:30 TestClassTemplate{{$}}473// CHECK-NEXT:  `-CXXRecordDecl 0x{{.+}} <line:{{.*}}:61, col:68> col:68 struct TestTemplateTemplateDefaultType{{$}}474 475// CHECK:       ClassTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:{{.*}}:3, col:82> col:48 TestTemplateTemplateDefaultType{{$}}476// CHECK-NEXT:  |-TemplateTemplateParmDecl 0x{{.+}} <col:12, col:37> col:37 depth 0 index 0 TT{{$}}477// CHECK-NEXT:  | |-TemplateTypeParmDecl 0x{{.+}} <col:21> col:29 typename depth 1 index 0{{$}}478// CHECK-NEXT:  | `-TemplateArgument <line:{{.*}}:42> template 'TestClassTemplate':'testClassTemplateDecl::TestClassTemplate' qualified{{$}}479// CHECK-NEXT:  |   |-inherited from TemplateTemplateParm 0x{{.+}} 'TT'{{$}}480// CHECK-NEXT:  |   `-ClassTemplateDecl 0x{{.+}} <line:{{.+}}:3, line:{{.+}}:3> line:{{.+}}:30 TestClassTemplate481// CHECK-NEXT:  `-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <line:{{.*}}:41, col:82> col:48 struct TestTemplateTemplateDefaultType definition{{$}}482// CHECK-NEXT:    |-DefinitionData empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init{{$}}483// CHECK-NEXT:    | |-DefaultConstructor exists trivial constexpr needs_implicit defaulted_is_constexpr{{$}}484// CHECK-NEXT:    | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param{{$}}485// CHECK-NEXT:    | |-MoveConstructor exists simple trivial needs_implicit{{$}}486// CHECK-NEXT:    | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param{{$}}487// CHECK-NEXT:    | |-MoveAssignment exists simple trivial needs_implicit{{$}}488// CHECK-NEXT:    | `-Destructor simple irrelevant trivial needs_implicit{{$}}489// CHECK-NEXT:    `-CXXRecordDecl 0x{{.+}} <col:41, col:48> col:48 implicit struct TestTemplateTemplateDefaultType{{$}}490 491 492namespace testClassTemplateDecl {493  template<typename T> struct TestClassTemplateWithScopedMemberEnum {494    enum class E1 : T { A, B, C, D };495    enum class E2 : int { A, B, C, D };496    enum class E3 : T;497    enum class E4 : int;498  };499 500  template struct TestClassTemplateWithScopedMemberEnum<unsigned>;501 502  TestClassTemplateWithScopedMemberEnum<int> TestClassTemplateWithScopedMemberEnumObject;503}504 505// CHECK:      ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-12]]:3, line:[[@LINE-7]]:3> line:[[@LINE-12]]:31 TestClassTemplateWithScopedMemberEnum506// CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 referenced typename depth 0 index 0 T507// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} <col:24, line:[[@LINE-9]]:3> line:[[@LINE-14]]:31 struct TestClassTemplateWithScopedMemberEnum definition508// CHECK:      | |-EnumDecl 0x[[#%x,SCOPED_MEMBER_ENUM_E1:]] <line:[[@LINE-14]]:5, col:36> col:16 class E1 'T'509// CHECK-NEXT: | | |-EnumConstantDecl 0x{{.+}} <col:25> col:25 A 'testClassTemplateDecl::TestClassTemplateWithScopedMemberEnum::E1'510// CHECK-NEXT: | | |-EnumConstantDecl 0x{{.+}} <col:28> col:28 B 'testClassTemplateDecl::TestClassTemplateWithScopedMemberEnum::E1'511// CHECK-NEXT: | | |-EnumConstantDecl 0x{{.+}} <col:31> col:31 C 'testClassTemplateDecl::TestClassTemplateWithScopedMemberEnum::E1'512// CHECK-NEXT: | | `-EnumConstantDecl 0x{{.+}} <col:34> col:34 D 'testClassTemplateDecl::TestClassTemplateWithScopedMemberEnum::E1'513// CHECK-NEXT: | |-EnumDecl 0x[[#%x,SCOPED_MEMBER_ENUM_E2:]] <line:[[@LINE-18]]:5, col:38> col:16 class E2 'int'514// CHECK-NEXT: | | |-EnumConstantDecl 0x{{.+}} <col:27> col:27 A 'testClassTemplateDecl::TestClassTemplateWithScopedMemberEnum::E2'515// CHECK-NEXT: | | |-EnumConstantDecl 0x{{.+}} <col:30> col:30 B 'testClassTemplateDecl::TestClassTemplateWithScopedMemberEnum::E2'516// CHECK-NEXT: | | |-EnumConstantDecl 0x{{.+}} <col:33> col:33 C 'testClassTemplateDecl::TestClassTemplateWithScopedMemberEnum::E2'517// CHECK-NEXT: | | `-EnumConstantDecl 0x{{.+}} <col:36> col:36 D 'testClassTemplateDecl::TestClassTemplateWithScopedMemberEnum::E2'518// CHECK-NEXT: | |-EnumDecl 0x[[#%x,SCOPED_MEMBER_ENUM_E3:]] <line:[[@LINE-22]]:5, col:21> col:16 class E3 'T'519// CHECK-NEXT: | `-EnumDecl 0x[[#%x,SCOPED_MEMBER_ENUM_E4:]] <line:[[@LINE-22]]:5, col:21> col:16 class E4 'int'520// CHECK-NEXT: |-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplateWithScopedMemberEnum'521// CHECK-NEXT: `-ClassTemplateSpecializationDecl 0x{{.+}} <line:[[@LINE-28]]:3, line:[[@LINE-23]]:3> line:[[@LINE-28]]:31 struct TestClassTemplateWithScopedMemberEnum definition instantiated_from 0x{{.+}} implicit_instantiation522// CHECK:        |-TemplateArgument type 'int'523// CHECK-NEXT:   | `-BuiltinType 0x{{.+}} 'int'524// CHECK:        |-EnumDecl 0x{{.+}} <line:[[@LINE-30]]:5, col:21> col:16 class E1 'int' instantiated_from 0x[[#SCOPED_MEMBER_ENUM_E1]]{{$}}525// CHECK-NEXT:   |-EnumDecl 0x{{.+}} <line:[[@LINE-30]]:5, col:21> col:16 class E2 'int' instantiated_from 0x[[#SCOPED_MEMBER_ENUM_E2]]{{$}}526// CHECK-NEXT:   |-EnumDecl 0x{{.+}} <line:[[@LINE-30]]:5, col:21> col:16 class E3 'int' instantiated_from 0x[[#SCOPED_MEMBER_ENUM_E3]]{{$}}527// CHECK-NEXT:   |-EnumDecl 0x{{.+}} <line:[[@LINE-30]]:5, col:21> col:16 class E4 'int' instantiated_from 0x[[#SCOPED_MEMBER_ENUM_E4]]{{$}}528 529// CHECK:      ClassTemplateSpecializationDecl 0x{{.+}} <{{.+}}:[[@LINE-29]]:3, col:65> col:19 struct TestClassTemplateWithScopedMemberEnum definition instantiated_from 0x{{.+}} explicit_instantiation_definition530// CHECK:      |-TemplateArgument type 'unsigned int'531// CHECK-NEXT: | `-BuiltinType 0x{{.+}} 'unsigned int'532// CHECK:      |-EnumDecl 0x{{.+}} <line:[[@LINE-38]]:5, col:21> col:16 class E1 'unsigned int' instantiated_from 0x[[#SCOPED_MEMBER_ENUM_E1]]{{$}}533// CHECK-NEXT: | |-EnumConstantDecl 0x{{.+}} <col:25> col:25 A 'testClassTemplateDecl::TestClassTemplateWithScopedMemberEnum<unsigned int>::E1'534// CHECK-NEXT: | |-EnumConstantDecl 0x{{.+}} <col:28> col:28 B 'testClassTemplateDecl::TestClassTemplateWithScopedMemberEnum<unsigned int>::E1'535// CHECK-NEXT: | |-EnumConstantDecl 0x{{.+}} <col:31> col:31 C 'testClassTemplateDecl::TestClassTemplateWithScopedMemberEnum<unsigned int>::E1'536// CHECK-NEXT: | `-EnumConstantDecl 0x{{.+}} <col:34> col:34 D 'testClassTemplateDecl::TestClassTemplateWithScopedMemberEnum<unsigned int>::E1'537// CHECK-NEXT: |-EnumDecl 0x{{.+}} <line:[[@LINE-42]]:5, col:21> col:16 class E2 'int' instantiated_from 0x[[#SCOPED_MEMBER_ENUM_E2]]{{$}}538// CHECK-NEXT: | |-EnumConstantDecl 0x{{.+}} <col:27> col:27 A 'testClassTemplateDecl::TestClassTemplateWithScopedMemberEnum<unsigned int>::E2'539// CHECK-NEXT: | |-EnumConstantDecl 0x{{.+}} <col:30> col:30 B 'testClassTemplateDecl::TestClassTemplateWithScopedMemberEnum<unsigned int>::E2'540// CHECK-NEXT: | |-EnumConstantDecl 0x{{.+}} <col:33> col:33 C 'testClassTemplateDecl::TestClassTemplateWithScopedMemberEnum<unsigned int>::E2'541// CHECK-NEXT: | `-EnumConstantDecl 0x{{.+}} <col:36> col:36 D 'testClassTemplateDecl::TestClassTemplateWithScopedMemberEnum<unsigned int>::E2'542// CHECK-NEXT: |-EnumDecl 0x{{.+}} <line:[[@LINE-46]]:5, col:21> col:16 class E3 'unsigned int' instantiated_from 0x[[#SCOPED_MEMBER_ENUM_E3]]{{$}}543// CHECK-NEXT: `-EnumDecl 0x{{.+}} <line:[[@LINE-46]]:5, col:21> col:16 class E4 'int' instantiated_from 0x[[#SCOPED_MEMBER_ENUM_E4]]{{$}}544 545 546 547 548namespace testClassTemplateDecl {549  template<typename T> struct TestClassTemplateWithUnscopedMemberEnum {550    enum E1 : T { E1_A, E1_B, E1_C, E1_D };551    enum E2 : int { E2_A, E2_B, E2_C, E2_D };552    enum E3 : T;553    enum E4 : int;554  };555 556  template struct TestClassTemplateWithUnscopedMemberEnum<unsigned>;557 558  TestClassTemplateWithUnscopedMemberEnum<unsigned> TestClassTemplateWithUnscopedMemberEnumObject;559}560 561// CHECK:      ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-12]]:3, line:[[@LINE-7]]:3> line:[[@LINE-12]]:31 TestClassTemplateWithUnscopedMemberEnum562// CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 referenced typename depth 0 index 0 T563// CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} <col:24, line:[[@LINE-9]]:3> line:[[@LINE-14]]:31 struct TestClassTemplateWithUnscopedMemberEnum definition564// CHECK:      | |-EnumDecl 0x[[#%x,UNSCOPED_MEMBER_ENUM_E1:]] <line:[[@LINE-14]]:5, col:42> col:10 E1 'T'565// CHECK-NEXT: | | |-EnumConstantDecl 0x{{.+}} <col:19> col:19 E1_A 'testClassTemplateDecl::TestClassTemplateWithUnscopedMemberEnum::E1'566// CHECK-NEXT: | | |-EnumConstantDecl 0x{{.+}} <col:25> col:25 E1_B 'testClassTemplateDecl::TestClassTemplateWithUnscopedMemberEnum::E1'567// CHECK-NEXT: | | |-EnumConstantDecl 0x{{.+}} <col:31> col:31 E1_C 'testClassTemplateDecl::TestClassTemplateWithUnscopedMemberEnum::E1'568// CHECK-NEXT: | | `-EnumConstantDecl 0x{{.+}} <col:37> col:37 E1_D 'testClassTemplateDecl::TestClassTemplateWithUnscopedMemberEnum::E1'569// CHECK-NEXT: | |-EnumDecl 0x[[#%x,UNSCOPED_MEMBER_ENUM_E2:]] <line:[[@LINE-18]]:5, col:44> col:10 E2 'int'570// CHECK-NEXT: | | |-EnumConstantDecl 0x{{.+}} <col:21> col:21 E2_A 'testClassTemplateDecl::TestClassTemplateWithUnscopedMemberEnum::E2'571// CHECK-NEXT: | | |-EnumConstantDecl 0x{{.+}} <col:27> col:27 E2_B 'testClassTemplateDecl::TestClassTemplateWithUnscopedMemberEnum::E2'572// CHECK-NEXT: | | |-EnumConstantDecl 0x{{.+}} <col:33> col:33 E2_C 'testClassTemplateDecl::TestClassTemplateWithUnscopedMemberEnum::E2'573// CHECK-NEXT: | | `-EnumConstantDecl 0x{{.+}} <col:39> col:39 E2_D 'testClassTemplateDecl::TestClassTemplateWithUnscopedMemberEnum::E2'574// CHECK-NEXT: | |-EnumDecl 0x[[#%x,UNSCOPED_MEMBER_ENUM_E3:]] <line:[[@LINE-22]]:5, col:15> col:10 E3 'T'575// CHECK-NEXT: | `-EnumDecl 0x[[#%x,UNSCOPED_MEMBER_ENUM_E4:]] <line:[[@LINE-22]]:5, col:15> col:10 E4 'int'576// CHECK-NEXT: `-ClassTemplateSpecialization {{.+}} 'TestClassTemplateWithUnscopedMemberEnum'577 578// CHECK:      ClassTemplateSpecializationDecl 0x{{.+}} <{{.+}}:[[@LINE-22]]:3, col:67> col:19 struct TestClassTemplateWithUnscopedMemberEnum definition instantiated_from 0x{{.+}} explicit_instantiation_definition579// CHECK:      |-TemplateArgument type 'unsigned int'580// CHECK-NEXT: | `-BuiltinType 0x{{.+}} 'unsigned int'581// CHECK:      |-EnumDecl 0x{{.+}} <line:[[@LINE-31]]:5, col:15> col:10 E1 'unsigned int' instantiated_from 0x[[#UNSCOPED_MEMBER_ENUM_E1]]{{$}}582// CHECK-NEXT: | |-EnumConstantDecl 0x{{.+}} <col:19> col:19 E1_A 'testClassTemplateDecl::TestClassTemplateWithUnscopedMemberEnum<unsigned int>::E1'583// CHECK-NEXT: | |-EnumConstantDecl 0x{{.+}} <col:25> col:25 E1_B 'testClassTemplateDecl::TestClassTemplateWithUnscopedMemberEnum<unsigned int>::E1'584// CHECK-NEXT: | |-EnumConstantDecl 0x{{.+}} <col:31> col:31 E1_C 'testClassTemplateDecl::TestClassTemplateWithUnscopedMemberEnum<unsigned int>::E1'585// CHECK-NEXT: | `-EnumConstantDecl 0x{{.+}} <col:37> col:37 E1_D 'testClassTemplateDecl::TestClassTemplateWithUnscopedMemberEnum<unsigned int>::E1'586// CHECK-NEXT: |-EnumDecl 0x{{.+}} <line:[[@LINE-35]]:5, col:15> col:10 E2 'int' instantiated_from 0x[[#UNSCOPED_MEMBER_ENUM_E2]]{{$}}587// CHECK-NEXT: | |-EnumConstantDecl 0x{{.+}} <col:21> col:21 E2_A 'testClassTemplateDecl::TestClassTemplateWithUnscopedMemberEnum<unsigned int>::E2'588// CHECK-NEXT: | |-EnumConstantDecl 0x{{.+}} <col:27> col:27 E2_B 'testClassTemplateDecl::TestClassTemplateWithUnscopedMemberEnum<unsigned int>::E2'589// CHECK-NEXT: | |-EnumConstantDecl 0x{{.+}} <col:33> col:33 E2_C 'testClassTemplateDecl::TestClassTemplateWithUnscopedMemberEnum<unsigned int>::E2'590// CHECK-NEXT: | `-EnumConstantDecl 0x{{.+}} <col:39> col:39 E2_D 'testClassTemplateDecl::TestClassTemplateWithUnscopedMemberEnum<unsigned int>::E2'591// CHECK-NEXT: |-EnumDecl 0x{{.+}} <line:[[@LINE-39]]:5, col:15> col:10 E3 'unsigned int' instantiated_from 0x[[#UNSCOPED_MEMBER_ENUM_E3]]{{$}}592// CHECK-NEXT: |-EnumDecl 0x{{.+}} <line:[[@LINE-39]]:5, col:15> col:10 E4 'int' instantiated_from 0x[[#UNSCOPED_MEMBER_ENUM_E4]]{{$}}593 594 595// PR15220 dump instantiation only once596namespace testCanonicalTemplate {597  class A {};598 599  template<typename T> void TestFunctionTemplate(T);600  template<typename T> void TestFunctionTemplate(T);601  void bar(A a) { TestFunctionTemplate(a); }602  // CHECK:      FunctionTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-3]]:3, col:51> col:29 TestFunctionTemplate{{$}}603  // CHECK-NEXT:   |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 referenced typename depth 0 index 0 T{{$}}604  // CHECK-NEXT:   |-FunctionDecl 0x{{.*}} <col:24, col:51> col:29 TestFunctionTemplate 'void (T)'{{$}}605  // CHECK-NEXT:   | `-ParmVarDecl 0x{{.*}} <col:50> col:51 'T'{{$}}606  // CHECK-NEXT:   `-FunctionDecl 0x{{.*}} <line:[[@LINE-6]]:24, col:51> col:29 used TestFunctionTemplate 'void (testCanonicalTemplate::A)' implicit_instantiation instantiated_from 0x{{.+}}{{$}}607  // CHECK-NEXT:     |-TemplateArgument type 'testCanonicalTemplate::A'{{$}}608  // CHECK-NEXT:     | `-RecordType 0x{{.+}} 'testCanonicalTemplate::A' canonical{{$}}609  // CHECK-NEXT:     |   `-CXXRecord 0x{{.+}} 'A'{{$}}610  // CHECK-NEXT:     `-ParmVarDecl 0x{{.*}} <col:50> col:51 'testCanonicalTemplate::A'{{$}}611 612  // CHECK:      FunctionTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-12]]:3, col:51> col:29 TestFunctionTemplate{{$}}613  // CHECK-NEXT:   |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 referenced typename depth 0 index 0 T{{$}}614  // CHECK-NEXT:   |-FunctionDecl{{.*}} 0x{{.+}} prev 0x{{.+}} <col:24, col:51> col:29 TestFunctionTemplate 'void (T)'{{$}}615  // CHECK-NEXT:   | `-ParmVarDecl 0x{{.+}} <col:50> col:51 'T'{{$}}616  // CHECK-NEXT:   `-Function 0x{{.+}} 'TestFunctionTemplate' 'void (testCanonicalTemplate::A)'{{$}}617  // CHECK-NOT:      TemplateArgument{{$}}618 619  template<typename T1> class TestClassTemplate {620    template<typename T2> friend class TestClassTemplate;621  };622  TestClassTemplate<A> a;623  // CHECK:      ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-4]]:3, line:[[@LINE-2]]:3> line:[[@LINE-4]]:31 TestClassTemplate{{$}}624  // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T1{{$}}625  // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} <col:25, line:[[@LINE-4]]:3> line:[[@LINE-6]]:31 class TestClassTemplate definition{{$}}626  // CHECK-NEXT: | |-DefinitionData empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init{{$}}627  // CHECK-NEXT: | | |-DefaultConstructor exists trivial constexpr needs_implicit defaulted_is_constexpr{{$}}628  // CHECK-NEXT: | | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param{{$}}629  // CHECK-NEXT: | | |-MoveConstructor exists simple trivial needs_implicit{{$}}630  // CHECK-NEXT: | | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param{{$}}631  // CHECK-NEXT: | | |-MoveAssignment exists simple trivial needs_implicit{{$}}632  // CHECK-NEXT: | | `-Destructor simple irrelevant trivial needs_implicit{{$}}633  // CHECK-NEXT: | |-CXXRecordDecl 0x{{.+}} <col:25, col:31> col:31 implicit class TestClassTemplate{{$}}634  // CHECK-NEXT: | `-FriendDecl 0x{{.+}} <line:[[@LINE-14]]:5, col:40> col:40{{$}}635  // CHECK-NEXT: |   `-ClassTemplateDecl 0x{{.+}} parent 0x{{.+}} <col:5, col:40> col:40 friend_undeclared TestClassTemplate{{$}}636  // CHECK-NEXT: |     |-TemplateTypeParmDecl 0x{{.+}} <col:14, col:23> col:23 typename depth 1 index 0 T2{{$}}637  // CHECK-NEXT: |     `-CXXRecordDecl 0x{{.+}} parent 0x{{.+}} <col:34, col:40> col:40 class TestClassTemplate{{$}}638  // CHECK-NEXT: `-ClassTemplateSpecializationDecl 0x{{.+}} <line:[[@LINE-19]]:3, line:[[@LINE-17]]:3> line:[[@LINE-19]]:31 class TestClassTemplate definition instantiated_from 0x{{.+}} implicit_instantiation{{$}}639  // 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{{$}}640  // CHECK-NEXT:   | |-DefaultConstructor exists trivial constexpr defaulted_is_constexpr{{$}}641  // CHECK-NEXT:   | |-CopyConstructor simple trivial has_const_param implicit_has_const_param{{$}}642  // CHECK-NEXT:   | |-MoveConstructor exists simple trivial{{$}}643  // CHECK-NEXT:   | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param{{$}}644  // CHECK-NEXT:   | |-MoveAssignment exists simple trivial needs_implicit{{$}}645  // CHECK-NEXT:   | `-Destructor simple irrelevant trivial needs_implicit{{$}}646  // CHECK-NEXT:   |-TemplateArgument type 'testCanonicalTemplate::A'{{$}}647  // CHECK-NEXT:   | `-RecordType 0x{{.+}} 'testCanonicalTemplate::A' canonical{{$}}648  // CHECK-NEXT:   |   `-CXXRecord 0x{{.+}} 'A'{{$}}649  // CHECK-NEXT:   |-CXXRecordDecl 0x{{.+}} <col:25, col:31> col:31 implicit class TestClassTemplate{{$}}650  // CHECK-NEXT:   |-FriendDecl 0x{{.+}} <line:[[@LINE-30]]:5, col:40> col:40{{$}}651  // CHECK-NEXT:   | `-ClassTemplateDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <col:5, col:40> col:40 friend TestClassTemplate{{$}}652  // CHECK-NEXT:   |   |-TemplateTypeParmDecl 0x{{.+}} <col:14, col:23> col:23 typename depth 0 index 0 T2{{$}}653  // CHECK-NEXT:   |   |-CXXRecordDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <col:34, col:40> col:40 class TestClassTemplate{{$}}654  // CHECK-NEXT:   |   `-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate'{{$}}655  // CHECK-NEXT:   |-CXXConstructorDecl 0x{{.+}} <line:[[@LINE-36]]:31> col:31 implicit used constexpr TestClassTemplate 'void () noexcept' inline default trivial{{$}}656  // CHECK-NEXT:   | `-CompoundStmt 0x{{.+}} <col:31>{{$}}657  // CHECK-NEXT:   |-CXXConstructorDecl 0x{{.+}} <col:31> col:31 implicit constexpr TestClassTemplate 'void (const TestClassTemplate<testCanonicalTemplate::A> &)' inline default trivial noexcept-unevaluated 0x{{.+}}{{$}}658  // CHECK-NEXT:   | `-ParmVarDecl 0x{{.+}} <col:31> col:31 'const TestClassTemplate<testCanonicalTemplate::A> &'{{$}}659  // CHECK-NEXT:   `-CXXConstructorDecl 0x{{.+}} <col:31> col:31 implicit constexpr TestClassTemplate 'void (TestClassTemplate<testCanonicalTemplate::A> &&)' inline default trivial noexcept-unevaluated 0x{{.+}}{{$}}660  // CHECK-NEXT:     `-ParmVarDecl 0x{{.+}} <col:31> col:31 'TestClassTemplate<testCanonicalTemplate::A> &&'{{$}}661 662 663  template<typename T1> class TestClassTemplate2;664  template<typename T1> class TestClassTemplate2;665  template<typename T1> class TestClassTemplate2 {666  };667  TestClassTemplate2<A> a2;668  // CHECK:      ClassTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-5]]:3, col:31> col:31 TestClassTemplate2{{$}}669  // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T1{{$}}670  // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} <col:25, col:31> col:31 class TestClassTemplate2{{$}}671  // CHECK-NEXT: `-ClassTemplateSpecializationDecl 0x{{.+}} <line:[[@LINE-6]]:3, line:[[@LINE-5]]:3> line:[[@LINE-6]]:31 class TestClassTemplate2 definition instantiated_from 0x{{.+}} implicit_instantiation{{$}}672  // 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{{$}}673  // CHECK-NEXT:   | |-DefaultConstructor exists trivial constexpr defaulted_is_constexpr{{$}}674  // CHECK-NEXT:   | |-CopyConstructor simple trivial has_const_param implicit_has_const_param{{$}}675  // CHECK-NEXT:   | |-MoveConstructor exists simple trivial{{$}}676  // CHECK-NEXT:   | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param{{$}}677  // CHECK-NEXT:   | |-MoveAssignment exists simple trivial needs_implicit{{$}}678  // CHECK-NEXT:   | `-Destructor simple irrelevant trivial needs_implicit{{$}}679  // CHECK-NEXT:   |-TemplateArgument type 'testCanonicalTemplate::A'{{$}}680  // CHECK-NEXT:   | `-RecordType 0x{{.+}} 'testCanonicalTemplate::A' canonical{{$}}681  // CHECK-NEXT:   |   `-CXXRecord 0x{{.+}} 'A'{{$}}682  // CHECK-NEXT:   |-CXXRecordDecl 0x{{.+}} <col:25, col:31> col:31 implicit class TestClassTemplate2{{$}}683  // CHECK-NEXT:   |-CXXConstructorDecl 0x{{.+}} <col:31> col:31 implicit used constexpr TestClassTemplate2 'void () noexcept' inline default trivial{{$}}684  // CHECK-NEXT:   | `-CompoundStmt 0x{{.+}} <col:31>{{$}}685  // CHECK-NEXT:   |-CXXConstructorDecl 0x{{.+}} <col:31> col:31 implicit constexpr TestClassTemplate2 'void (const TestClassTemplate2<testCanonicalTemplate::A> &)' inline default trivial noexcept-unevaluated 0x{{.+}}{{$}}686  // CHECK-NEXT:   | `-ParmVarDecl 0x{{.+}} <col:31> col:31 'const TestClassTemplate2<testCanonicalTemplate::A> &'{{$}}687  // CHECK-NEXT:   `-CXXConstructorDecl 0x{{.+}} <col:31> col:31 implicit constexpr TestClassTemplate2 'void (TestClassTemplate2<testCanonicalTemplate::A> &&)' inline default trivial noexcept-unevaluated 0x{{.+}}{{$}}688  // CHECK-NEXT:     `-ParmVarDecl 0x{{.+}} <col:31> col:31 'TestClassTemplate2<testCanonicalTemplate::A> &&'{{$}}689 690  // CHECK:      ClassTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-26]]:3, col:31> col:31 TestClassTemplate2{{$}}691  // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T1{{$}}692  // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <col:25, col:31> col:31 class TestClassTemplate2{{$}}693  // CHECK-NEXT: `-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate2'{{$}}694 695  // CHECK:      ClassTemplateDecl 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-30]]:3, line:[[@LINE-29]]:3> line:[[@LINE-30]]:31 TestClassTemplate2{{$}}696  // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T1{{$}}697  // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} prev 0x{{.+}} <col:25, line:[[@LINE-31]]:3> line:[[@LINE-32]]:31 class TestClassTemplate2 definition{{$}}698  // CHECK-NEXT: | |-DefinitionData empty aggregate standard_layout trivially_copyable pod trivial literal has_constexpr_non_copy_move_ctor can_const_default_init{{$}}699  // CHECK-NEXT: | | |-DefaultConstructor exists trivial constexpr needs_implicit defaulted_is_constexpr{{$}}700  // CHECK-NEXT: | | |-CopyConstructor simple trivial has_const_param needs_implicit implicit_has_const_param{{$}}701  // CHECK-NEXT: | | |-MoveConstructor exists simple trivial needs_implicit{{$}}702  // CHECK-NEXT: | | |-CopyAssignment simple trivial has_const_param needs_implicit implicit_has_const_param{{$}}703  // CHECK-NEXT: | | |-MoveAssignment exists simple trivial needs_implicit{{$}}704  // CHECK-NEXT: | | `-Destructor simple irrelevant trivial needs_implicit{{$}}705  // CHECK-NEXT: | `-CXXRecordDecl 0x{{.+}} <col:25, col:31> col:31 implicit class TestClassTemplate2{{$}}706  // CHECK-NEXT: `-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate2'{{$}}707 708  struct S {709      template<typename T> static const T TestVarTemplate; // declaration of a static data member template710  };711  template<typename T>712  const T S::TestVarTemplate = { }; // definition of a static data member template713 714  void f()715  {716    int i = S::TestVarTemplate<int>;717    int j = S::TestVarTemplate<int>;718  }719 720  // CHECK:      VarTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-11]]:7, col:43> col:43 TestVarTemplate{{$}}721  // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:16, col:25> col:25 referenced typename depth 0 index 0 T{{$}}722  // CHECK-NEXT: |-VarDecl 0x{{.+}} <col:28, col:43> col:43 TestVarTemplate 'const T' static instantiated_from 0x{{.+}}{{$}}723  // CHECK-NEXT: |-VarTemplateSpecializationDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <line:[[@LINE-12]]:3, line:[[@LINE-11]]:34> col:14 referenced TestVarTemplate 'const int' implicit_instantiation cinit instantiated_from 0x{{.+}}{{$}}724  // CHECK-NEXT: | |-NestedNameSpecifier TypeSpec 'S'{{$}}725  // CHECK-NEXT: | |-TemplateArgument type 'int'{{$}}726  // CHECK-NEXT: | | `-BuiltinType 0x{{.+}} 'int'{{$}}727  // CHECK-NEXT: | `-InitListExpr 0x{{.+}} <col:32, col:34> 'int'{{$}}728  // CHECK-NEXT: `-VarTemplateSpecializationDecl 0x{{.+}} <line:[[@LINE-19]]:7, col:43> col:43 referenced TestVarTemplate 'const int' implicit_instantiation static instantiated_from 0x{{.+}}{{$}}729  // CHECK-NEXT:   `-TemplateArgument type 'int'{{$}}730 731  // CHECK:     VarTemplateSpecializationDecl 0x{{.+}} <{{.+}}:[[@LINE-22]]:7, col:43> col:43 referenced TestVarTemplate 'const int' implicit_instantiation static instantiated_from 0x{{.+}}{{$}}732  // CHECK-NEXT:`-TemplateArgument type 'int'{{$}}733  // CHECK-NEXT:  `-BuiltinType 0x{{.+}} 'int'{{$}}734 735  // CHECK:      VarTemplateDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-24]]:3, line:[[@LINE-23]]:34> col:14 TestVarTemplate{{$}}736  // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <line:[[@LINE-25]]:12, col:21> col:21 referenced typename depth 0 index 0 T{{$}}737  // CHECK-NEXT: |-VarDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <line:[[@LINE-25]]:3, col:34> col:14 TestVarTemplate 'const T' cinit instantiated_from 0x{{.+}}{{$}}738  // CHECK-NEXT: | |-NestedNameSpecifier TypeSpec 'S'{{$}}739  // CHECK-NEXT: | `-InitListExpr 0x{{.+}} <col:32, col:34> 'void'{{$}}740  // CHECK-NEXT: |-VarTemplateSpecialization 0x{{.+}} 'TestVarTemplate' 'const int'{{$}}741  // CHECK-NEXT: `-VarTemplateSpecialization 0x{{.+}} 'TestVarTemplate' 'const int'{{$}}742 743  // CHECK:      VarTemplateSpecializationDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} <{{.+}}:[[@LINE-32]]:3, line:[[@LINE-31]]:34> col:14 referenced TestVarTemplate 'const int' implicit_instantiation cinit instantiated_from 0x{{.+}}{{$}}744  // CHECK-NEXT: |-NestedNameSpecifier TypeSpec 'S'{{$}}745  // CHECK-NEXT: |-TemplateArgument type 'int'{{$}}746  // CHECK-NEXT: | `-BuiltinType 0x{{.+}} 'int'{{$}}747  // CHECK-NEXT: `-InitListExpr 0x{{.+}} <col:32, col:34> 'int'{{$}}748}749 750template <class T>751class TestClassScopeFunctionSpecialization {752  template<class U> void foo(U a) { }753  template<> void foo<int>(int a) { }754};755// CHECK:      FunctionTemplateDecl{{.*}} foo756// CHECK-NEXT:   TemplateTypeParmDecl{{.*}} referenced class depth 1 index 0 U757// CHECK-NEXT:   CXXMethodDecl{{.*}} foo 'void (U)' implicit-inline758// CHECK-NEXT:     ParmVarDecl759// CHECK-NEXT:     CompoundStmt760// CHECK-NEXT: CXXMethodDecl{{.*}} foo 'void (int)' explicit_specialization implicit-inline761// CHECK-NEXT:   TemplateArgument{{.*}} 'int'762// CHECK-NEXT:     BuiltinType{{.*}} 'int'763// CHECK-NEXT:   ParmVarDecl764// CHECK-NEXT:   CompoundStmt765 766namespace TestTemplateTypeParmDecl {767  template<typename ... T, class U = int> void foo();768}769// CHECK:      NamespaceDecl{{.*}} TestTemplateTypeParmDecl770// CHECK-NEXT:   FunctionTemplateDecl771// CHECK-NEXT:     TemplateTypeParmDecl{{.*}} typename depth 0 index 0 ... T772// CHECK-NEXT:     TemplateTypeParmDecl{{.*}} class depth 0 index 1 U773// CHECK-NEXT:       TemplateArgument type 'int'774 775namespace TestNonTypeTemplateParmDecl {776  template<int I = 1, int ... J> void foo();777}778// CHECK:      NamespaceDecl{{.*}} TestNonTypeTemplateParmDecl779// CHECK-NEXT:   FunctionTemplateDecl780// CHECK-NEXT:     NonTypeTemplateParmDecl{{.*}} 'int' depth 0 index 0 I781// CHECK-NEXT:       TemplateArgument {{.*}} expr782// CHECK-NEXT:         IntegerLiteral{{.*}} 'int' 1783// CHECK-NEXT:     NonTypeTemplateParmDecl{{.*}} 'int' depth 0 index 1 ... J784 785namespace TestTemplateTemplateParmDecl {786  template<typename T> class A;787  template <template <typename> class T = A, template <typename> class ... U> void foo();788}789// CHECK:      NamespaceDecl{{.*}} TestTemplateTemplateParmDecl790// CHECK:        FunctionTemplateDecl791// CHECK-NEXT:     TemplateTemplateParmDecl{{.*}} T792// CHECK-NEXT:       TemplateTypeParmDecl{{.*}} typename793// CHECK-NEXT:       TemplateArgument{{.*}} template 'A':'TestTemplateTemplateParmDecl::A' qualified{{$}}794// CHECK-NEXT:         ClassTemplateDecl {{.*}} A795// CHECK-NEXT:     TemplateTemplateParmDecl{{.*}} ... U796// CHECK-NEXT:       TemplateTypeParmDecl{{.*}} typename797 798namespace TestTemplateArgument {799  template<typename> class A { };800  template<template<typename> class ...> class B { };801  int foo();802 803  template<typename> class testType { };804  template class testType<int>;805  // CHECK:      ClassTemplateSpecializationDecl{{.*}} class testType806  // CHECK:        TemplateArgument{{.*}} type 'int'807 808  template<int fp(void)> class testDecl { };809  template class testDecl<foo>;810  // CHECK:      ClassTemplateSpecializationDecl{{.*}} class testDecl811  // CHECK:        TemplateArgument{{.*}} decl812  // CHECK-NEXT:     Function{{.*}}foo813 814  template class testDecl<nullptr>;815  // CHECK:      ClassTemplateSpecializationDecl{{.*}} class testDecl816  // CHECK:        TemplateArgument{{.*}} nullptr817 818  template<int> class testIntegral { };819  template class testIntegral<1>;820  // CHECK:      ClassTemplateSpecializationDecl{{.*}} class testIntegral821  // CHECK:        TemplateArgument{{.*}} integral '1'822 823  template<template<typename> class> class testTemplate { };824  template class testTemplate<A>;825  // CHECK:      ClassTemplateSpecializationDecl{{.*}} class testTemplate826  // CHECK:        TemplateArgument{{.*}} 'TestTemplateArgument::A'{{$}}827 828  template<template<typename> class ...T> class C {829    B<T...> testTemplateExpansion;830  };831  // FIXME: Need TemplateSpecializationType dumping to test TemplateExpansion.832 833  template<int, int = 0> class testExpr;834  template<int I> class testExpr<I> { };835  // CHECK:      ClassTemplatePartialSpecializationDecl{{.*}} class testExpr836  // CHECK:        TemplateArgument{{.*}} expr837  // CHECK-NEXT:     DeclRefExpr{{.*}}I838 839  template<int, int ...> class testPack { };840  template class testPack<0, 1, 2>;841  // CHECK:      ClassTemplateSpecializationDecl{{.*}} class testPack842  // CHECK:        TemplateArgument{{.*}} integral '0'843  // CHECK-NEXT:   TemplateArgument{{.*}} pack844  // CHECK-NEXT:     TemplateArgument{{.*}} integral '1'845  // CHECK-NEXT:     TemplateArgument{{.*}} integral '2'846}847 848namespace testUsingDecl {849  int i;850}851namespace TestUsingDecl {852  using testUsingDecl::i;853}854// CHECK:      NamespaceDecl{{.*}} TestUsingDecl855// CHECK-NEXT:   UsingDecl{{.*}} testUsingDecl::i856// CHECK-NEXT:   | `-NestedNameSpecifier Namespace 0x{{.*}} 'testUsingDecl857// CHECK-NEXT:   UsingShadowDecl{{.*}} Var{{.*}} 'i' 'int'858 859namespace testUnresolvedUsing {860  class A { };861  template<class T> class B {862  public:863    A a;864  };865  template<class T> class TestUnresolvedUsing : public B<T> {866    using typename B<T>::a;867    using B<T>::a;868  };869}870// CHECK: CXXRecordDecl{{.*}} TestUnresolvedUsing871// CHECK:   UnresolvedUsingTypenameDecl{{.*}} B<T>::a872// CHECK:   UnresolvedUsingValueDecl{{.*}} B<T>::a873 874namespace TestLinkageSpecDecl {875  extern "C" void test1();876  extern "C++" void test2();877}878// CHECK:      NamespaceDecl{{.*}} TestLinkageSpecDecl879// CHECK-NEXT:   LinkageSpecDecl{{.*}} C880// CHECK-NEXT:     FunctionDecl881// CHECK-NEXT:   LinkageSpecDecl{{.*}} C++882// CHECK-NEXT:     FunctionDecl883 884class TestAccessSpecDecl {885public:886private:887protected:888};889// CHECK:      CXXRecordDecl{{.*}} class TestAccessSpecDecl890// CHECK:         CXXRecordDecl{{.*}} class TestAccessSpecDecl891// CHECK-NEXT:    AccessSpecDecl{{.*}} public892// CHECK-NEXT:    AccessSpecDecl{{.*}} private893// CHECK-NEXT:    AccessSpecDecl{{.*}} protected894 895template<typename T> class TestFriendDecl {896  friend int foo();897  friend class A;898  friend T;899};900// CHECK:      CXXRecord{{.*}} TestFriendDecl901// CHECK:        CXXRecord{{.*}} TestFriendDecl902// CHECK-NEXT:   FriendDecl903// CHECK-NEXT:     FunctionDecl{{.*}} foo904// CHECK-NEXT:   FriendDecl{{.*}} 'class A'905// CHECK-NEXT:     CXXRecordDecl{{.*}} class A906// CHECK-NEXT:   FriendDecl{{.*}} 'T'907 908namespace TestFileScopeAsmDecl {909  asm("ret");910}911// CHECK:      NamespaceDecl{{.*}} TestFileScopeAsmDecl{{$}}912// CHECK:        FileScopeAsmDecl{{.*> .*$}}913// CHECK-NEXT:     StringLiteral914 915namespace TestFriendDecl2 {916  void f();917  struct S {918    friend void f();919  };920}921// CHECK: NamespaceDecl [[TestFriendDecl2:0x.*]] <{{.*}}> {{.*}} TestFriendDecl2922// CHECK: |-FunctionDecl [[TestFriendDecl2_f:0x.*]] <{{.*}}> {{.*}} f 'void ()'923// CHECK: `-CXXRecordDecl {{.*}} struct S924// CHECK:   |-CXXRecordDecl {{.*}} struct S925// CHECK:   `-FriendDecl926// CHECK:     `-FunctionDecl {{.*}} parent [[TestFriendDecl2]] prev [[TestFriendDecl2_f]] <{{.*}}> {{.*}} f 'void ()'927 928namespace Comment {929  extern int Test;930  /// Something here.931  extern int Test;932  extern int Test;933}934 935// CHECK: VarDecl {{.*}} Test 'int' extern936// CHECK-NOT: FullComment937// CHECK: VarDecl {{.*}} Test 'int' extern938// CHECK: `-FullComment939// CHECK:   `-ParagraphComment940// CHECK:       `-TextComment941// CHECK: VarDecl {{.*}} Test 'int' extern942// CHECK-NOT: FullComment943 944namespace TestConstexprVariableTemplateWithInitializer {945  template<typename T> constexpr T foo{};946  // CHECK:      VarTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-1]]:3, col:40> col:36 foo{{$}}947  // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 referenced typename depth 0 index 0 T{{$}}948  // CHECK-NEXT: `-VarDecl 0x{{.+}} <col:24, col:40> col:36 foo 'const T' constexpr listinit instantiated_from 0x{{.+}}{{$}}949  // CHECK-NEXT:  `-InitListExpr 0x{{.+}} <col:39, col:40> 'void'{{$}}950 951  template<typename T> constexpr int val{42};952  // CHECK:      VarTemplateDecl 0x{{.+}} <{{.+}}:[[@LINE-1]]:3, col:44> col:38 val{{$}}953  // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:12, col:21> col:21 typename depth 0 index 0 T{{$}}954  // CHECK-NEXT: `-VarDecl 0x{{.+}} <col:24, col:44> col:38 val 'const int' constexpr listinit instantiated_from 0x{{.+}}{{$}}955  // CHECK-NEXT:  |-value: Int 42{{$}}956  // CHECK-NEXT:  `-InitListExpr 0x{{.+}} <col:41, col:44> 'int'{{$}}957 958  template <typename _Tp>959  struct in_place_type_t {960    explicit in_place_type_t() = default;961  };962 963  template <typename _Tp>964  inline constexpr in_place_type_t<_Tp> in_place_type{};965  // CHECK:     -VarTemplateDecl 0x{{.+}} <line:[[@LINE-2]]:3, line:[[@LINE-1]]:55> col:41 in_place_type{{$}}966  // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <line:[[@LINE-3]]:13, col:22> col:22 referenced typename depth 0 index 0 _Tp{{$}}967  // CHECK-NEXT: `-VarDecl 0x{{.+}} <line:[[@LINE-3]]:3, col:55> col:41 in_place_type 'const in_place_type_t<_Tp>' inline constexpr listinit instantiated_from 0x{{.+}}{{$}}968  // CHECK-NEXT:  `-InitListExpr 0x{{.+}} <col:54, col:55> 'void'{{$}}969 970  template <typename T> constexpr T call_init(0);971  // CHECK:     -VarTemplateDecl 0x{{.+}} <line:[[@LINE-1]]:3, col:48> col:37 call_init{{$}}972  // CHECK-NEXT: |-TemplateTypeParmDecl 0x{{.+}} <col:13, col:22> col:22 referenced typename depth 0 index 0 T{{$}}973  // CHECK-NEXT: `-VarDecl 0x{{.+}} <col:25, col:48> col:37 call_init 'const T' constexpr callinit instantiated_from 0x{{.+}}{{$}}974  // CHECK-NEXT:  `-ParenListExpr 0x{{.+}} <col:46, col:48> 'NULL TYPE'{{$}}975  // CHECK-NEXT:   `-IntegerLiteral 0x{{.+}} <col:47> 'int' 0{{$}}976}977 978namespace TestInjectedClassName {979  struct A {980    using T1 = A;981    using T2 = A;982  };983  // CHECK-LABEL: Dumping TestInjectedClassName:984  // CHECK:       CXXRecordDecl [[TestInjectedClassName_RD:0x[^ ]+]] {{.*}} struct A definition985  // CHECK:       CXXRecordDecl {{.*}} implicit referenced struct A986  // CHECK-NEXT:  |-TypeAliasDecl {{.*}} T1 'A'987  // CHECK-NEXT:  | `-RecordType [[TestInjectedClassName_RT:0x[^ ]+]] 'A' injected988  // CHECK-NEXT:  |   `-CXXRecord [[TestInjectedClassName_RD]] 'A'989  // CHECK-NEXT:  `-TypeAliasDecl {{.*}} T2 'A'990  // CHECK-NEXT:    `-RecordType [[TestInjectedClassName_RT]] 'A' injected991  // CHECK-NEXT:      `-CXXRecord [[TestInjectedClassName_RD]] 'A'992} // namespace InjectedClassName993 994namespace TestGH155936 {995  struct Foo {996    struct A {997      struct Foo {};998    };999  };1000  // CHECK-LABEL: Dumping TestGH155936:1001  // CHECK: CXXRecordDecl 0x{{.+}} <{{.+}}> line:[[@LINE-6]]:10 struct Foo definition1002  // CHECK: CXXRecordDecl 0x{{.+}} <col:3, col:10> col:10 implicit struct Foo1003  // CHECK: CXXRecordDecl 0x{{.+}} <{{.+}}> line:[[@LINE-7]]:12 struct A definition1004  // CHECK: CXXRecordDecl 0x{{.+}} <col:5, col:12> col:12 implicit struct A1005  // CHECK: CXXRecordDecl 0x{{.+}} <line:[[@LINE-8]]:7, col:19> col:14 struct Foo definition1006  // CHECH: CXXRecordDecl 0x{{.+}} <col:9, col:16> col:16 implicit struct Foo1007} // namspace GH1559361008