// RUN: %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -fms-extensions -ast-dump -ast-dump-filter Test %s | FileCheck -check-prefix CHECK -strict-whitespace %s class testEnumDecl { enum class TestEnumDeclScoped; enum TestEnumDeclFixed : int; }; // CHECK: EnumDecl{{.*}} class TestEnumDeclScoped 'int' // CHECK: EnumDecl{{.*}} TestEnumDeclFixed 'int' class testFieldDecl { int TestFieldDeclInit = 0; }; // CHECK: FieldDecl{{.*}} TestFieldDeclInit 'int' // CHECK-NEXT: IntegerLiteral namespace testVarDeclNRVO { class A { }; A foo() { A TestVarDeclNRVO; return TestVarDeclNRVO; } } // CHECK: VarDecl{{.*}} TestVarDeclNRVO 'class testVarDeclNRVO::A' nrvo void testParmVarDeclInit(int TestParmVarDeclInit = 0); // CHECK: ParmVarDecl{{.*}} TestParmVarDeclInit 'int' // CHECK-NEXT: IntegerLiteral{{.*}} namespace TestNamespaceDecl { int i; } // CHECK: NamespaceDecl{{.*}} TestNamespaceDecl // CHECK-NEXT: VarDecl namespace TestNamespaceDecl { int j; } // CHECK: NamespaceDecl{{.*}} TestNamespaceDecl // CHECK-NEXT: original Namespace // CHECK-NEXT: VarDecl inline namespace TestNamespaceDeclInline { } // CHECK: NamespaceDecl{{.*}} TestNamespaceDeclInline inline namespace testUsingDirectiveDecl { namespace A { } } namespace TestUsingDirectiveDecl { using namespace testUsingDirectiveDecl::A; } // CHECK: NamespaceDecl{{.*}} TestUsingDirectiveDecl // CHECK-NEXT: UsingDirectiveDecl{{.*}} Namespace{{.*}} 'A' namespace testNamespaceAlias { namespace A { } } namespace TestNamespaceAlias = testNamespaceAlias::A; // CHECK: NamespaceAliasDecl{{.*}} TestNamespaceAlias // CHECK-NEXT: Namespace{{.*}} 'A' using TestTypeAliasDecl = int; // CHECK: TypeAliasDecl{{.*}} TestTypeAliasDecl 'int' namespace testTypeAliasTemplateDecl { template class A; template using TestTypeAliasTemplateDecl = A; } // CHECK: TypeAliasTemplateDecl{{.*}} TestTypeAliasTemplateDecl // CHECK-NEXT: TemplateTypeParmDecl // CHECK-NEXT: TypeAliasDecl{{.*}} TestTypeAliasTemplateDecl 'A' namespace testCXXRecordDecl { class A { }; class B { }; class TestCXXRecordDecl : virtual A, public B { int i; }; } // CHECK: CXXRecordDecl{{.*}} class TestCXXRecordDecl // CHECK-NEXT: virtual private 'class testCXXRecordDecl::A' // CHECK-NEXT: public 'class testCXXRecordDecl::B' // CHECK-NEXT: CXXRecordDecl{{.*}} class TestCXXRecordDecl // CHECK-NEXT: FieldDecl template class TestCXXRecordDeclPack : public T... { }; // CHECK: CXXRecordDecl{{.*}} class TestCXXRecordDeclPack // CHECK-NEXT: public 'T'... // CHECK-NEXT: CXXRecordDecl{{.*}} class TestCXXRecordDeclPack thread_local int TestThreadLocalInt; // CHECK: TestThreadLocalInt {{.*}} tls_dynamic __module_private__ class TestCXXRecordDeclPrivate; // CHECK: CXXRecordDecl{{.*}} class TestCXXRecordDeclPrivate __module_private__ class testCXXMethodDecl { __module_private__ void TestCXXMethodDeclPrivate(); virtual void TestCXXMethodDeclPure() = 0; void TestCXXMethodDeclDelete() = delete; void TestCXXMethodDeclThrow() throw(); void TestCXXMethodDeclThrowType() throw(int); }; // CHECK: CXXMethodDecl{{.*}} TestCXXMethodDeclPrivate 'void (void)' __module_private__ // CHECK: CXXMethodDecl{{.*}} TestCXXMethodDeclPure 'void (void)' virtual pure // CHECK: CXXMethodDecl{{.*}} TestCXXMethodDeclDelete 'void (void)' delete // CHECK: CXXMethodDecl{{.*}} TestCXXMethodDeclThrow 'void (void) throw()' // CHECK: CXXMethodDecl{{.*}} TestCXXMethodDeclThrowType 'void (void) throw(int)' namespace testCXXConstructorDecl { class A { }; class TestCXXConstructorDecl : public A { int I; TestCXXConstructorDecl(A &a, int i) : A(a), I(i) { } TestCXXConstructorDecl(A &a) : TestCXXConstructorDecl(a, 0) { } }; } // CHECK: CXXConstructorDecl{{.*}} TestCXXConstructorDecl 'void {{.*}}' // CHECK-NEXT: ParmVarDecl{{.*}} a // CHECK-NEXT: ParmVarDecl{{.*}} i // CHECK-NEXT: CXXCtorInitializer{{.*}}A // CHECK-NEXT: Expr // CHECK: CXXCtorInitializer{{.*}}I // CHECK-NEXT: Expr // CHECK: CompoundStmt // CHECK: CXXConstructorDecl{{.*}} TestCXXConstructorDecl 'void {{.*}}' // CHECK-NEXT: ParmVarDecl{{.*}} a // CHECK-NEXT: CXXCtorInitializer{{.*}}TestCXXConstructorDecl // CHECK-NEXT: CXXConstructExpr{{.*}}TestCXXConstructorDecl class TestCXXDestructorDecl { ~TestCXXDestructorDecl() { } }; // CHECK: CXXDestructorDecl{{.*}} ~TestCXXDestructorDecl 'void (void) noexcept' // CHECK-NEXT: CompoundStmt // Test that the range of a defaulted members is computed correctly. class TestMemberRanges { public: TestMemberRanges() = default; TestMemberRanges(const TestMemberRanges &Other) = default; TestMemberRanges(TestMemberRanges &&Other) = default; ~TestMemberRanges() = default; TestMemberRanges &operator=(const TestMemberRanges &Other) = default; TestMemberRanges &operator=(TestMemberRanges &&Other) = default; }; void SomeFunction() { TestMemberRanges A; TestMemberRanges B(A); B = A; A = static_cast(B); TestMemberRanges C(static_cast(A)); } // CHECK: CXXConstructorDecl{{.*}} // CHECK: CXXConstructorDecl{{.*}} // CHECK: CXXConstructorDecl{{.*}} // CHECK: CXXDestructorDecl{{.*}} // CHECK: CXXMethodDecl{{.*}} // CHECK: CXXMethodDecl{{.*}} class TestCXXConversionDecl { operator int() { return 0; } }; // CHECK: CXXConversionDecl{{.*}} operator int 'int (void)' // CHECK-NEXT: CompoundStmt namespace TestStaticAssertDecl { static_assert(true, "msg"); } // CHECK: NamespaceDecl{{.*}} TestStaticAssertDecl // CHECK-NEXT: StaticAssertDecl{{.*> .*$}} // CHECK-NEXT: CXXBoolLiteralExpr // CHECK-NEXT: StringLiteral namespace testFunctionTemplateDecl { class A { }; class B { }; class C { }; class D { }; template void TestFunctionTemplate(T) { } // implicit instantiation void bar(A a) { TestFunctionTemplate(a); } // explicit specialization template<> void TestFunctionTemplate(B); // explicit instantiation declaration extern template void TestFunctionTemplate(C); // explicit instantiation definition template void TestFunctionTemplate(D); } // CHECK: FunctionTemplateDecl{{.*}} TestFunctionTemplate // CHECK-NEXT: TemplateTypeParmDecl // CHECK-NEXT: FunctionDecl{{.*}} TestFunctionTemplate 'void (T)' // CHECK-NEXT: ParmVarDecl{{.*}} 'T' // CHECK-NEXT: CompoundStmt // CHECK-NEXT: FunctionDecl{{.*}} TestFunctionTemplate {{.*}}A // CHECK-NEXT: TemplateArgument // CHECK-NEXT: ParmVarDecl // CHECK-NEXT: CompoundStmt // CHECK-NEXT: Function{{.*}} 'TestFunctionTemplate' {{.*}}B // CHECK-NEXT: FunctionDecl{{.*}} TestFunctionTemplate {{.*}}C // CHECK-NEXT: TemplateArgument // CHECK-NEXT: ParmVarDecl // CHECK-NEXT: FunctionDecl{{.*}} TestFunctionTemplate {{.*}}D // CHECK-NEXT: TemplateArgument // CHECK-NEXT: ParmVarDecl // CHECK-NEXT: CompoundStmt // CHECK: FunctionDecl{{.*}} TestFunctionTemplate {{.*}}B // CHECK-NEXT: TemplateArgument // CHECK-NEXT: ParmVarDecl namespace testClassTemplateDecl { class A { }; class B { }; class C { }; class D { }; template class TestClassTemplate { int i; }; // implicit instantiation TestClassTemplate a; // explicit specialization template<> class TestClassTemplate { int j; }; // explicit instantiation declaration extern template class TestClassTemplate; // explicit instantiation definition template class TestClassTemplate; // partial explicit specialization template class TestClassTemplatePartial { int i; }; template class TestClassTemplatePartial { int j; }; } // CHECK: ClassTemplateDecl{{.*}} TestClassTemplate // CHECK-NEXT: TemplateTypeParmDecl // CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate // CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate // CHECK-NEXT: FieldDecl{{.*}} i // CHECK-NEXT: ClassTemplateSpecializationDecl{{.*}} class TestClassTemplate // CHECK-NEXT: TemplateArgument{{.*}}A // CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate // CHECK-NEXT: FieldDecl{{.*}} i // CHECK: ClassTemplateSpecialization{{.*}} 'TestClassTemplate' // CHECK-NEXT: ClassTemplateSpecialization{{.*}} 'TestClassTemplate' // CHECK-NEXT: ClassTemplateSpecialization{{.*}} 'TestClassTemplate' // CHECK: ClassTemplateSpecializationDecl{{.*}} class TestClassTemplate // CHECK-NEXT: TemplateArgument{{.*}}B // CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate // CHECK-NEXT: FieldDecl{{.*}} j // CHECK: ClassTemplateSpecializationDecl{{.*}} class TestClassTemplate // CHECK-NEXT: TemplateArgument{{.*}}C // CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate // CHECK-NEXT: FieldDecl{{.*}} i // CHECK: ClassTemplateSpecializationDecl{{.*}} class TestClassTemplate // CHECK-NEXT: TemplateArgument{{.*}}D // CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate // CHECK-NEXT: FieldDecl{{.*}} i // CHECK: ClassTemplatePartialSpecializationDecl{{.*}} class TestClassTemplatePartial // CHECK-NEXT: TemplateArgument // CHECK-NEXT: TemplateArgument{{.*}}A // CHECK-NEXT: TemplateTypeParmDecl // CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplatePartial // CHECK-NEXT: FieldDecl{{.*}} j // PR15220 dump instantiation only once namespace testCanonicalTemplate { class A {}; template void TestFunctionTemplate(T); template void TestFunctionTemplate(T); void bar(A a) { TestFunctionTemplate(a); } // CHECK: FunctionTemplateDecl{{.*}} TestFunctionTemplate // CHECK-NEXT: TemplateTypeParmDecl // CHECK-NEXT: FunctionDecl{{.*}} TestFunctionTemplate 'void (T)' // CHECK-NEXT: ParmVarDecl{{.*}} 'T' // CHECK-NEXT: FunctionDecl{{.*}} TestFunctionTemplate {{.*}}A // CHECK-NEXT: TemplateArgument // CHECK-NEXT: ParmVarDecl // CHECK: FunctionTemplateDecl{{.*}} TestFunctionTemplate // CHECK-NEXT: TemplateTypeParmDecl // CHECK-NEXT: FunctionDecl{{.*}} TestFunctionTemplate 'void (T)' // CHECK-NEXT: ParmVarDecl{{.*}} 'T' // CHECK-NEXT: Function{{.*}} 'TestFunctionTemplate' // CHECK-NOT: TemplateArgument template class TestClassTemplate { template friend class TestClassTemplate; }; TestClassTemplate a; // CHECK: ClassTemplateDecl{{.*}} TestClassTemplate // CHECK-NEXT: TemplateTypeParmDecl // CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate // CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate // CHECK-NEXT: FriendDecl // CHECK-NEXT: ClassTemplateDecl{{.*}} TestClassTemplate // CHECK-NEXT: TemplateTypeParmDecl // CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate // CHECK-NEXT: ClassTemplateSpecialization{{.*}} 'TestClassTemplate' // CHECK-NEXT: ClassTemplateSpecializationDecl{{.*}} class TestClassTemplate // CHECK-NEXT: TemplateArgument{{.*}}A // CHECK-NEXT: CXXRecordDecl{{.*}} class TestClassTemplate } template class TestClassScopeFunctionSpecialization { template void foo(U a) { } template<> void foo(int a) { } }; // CHECK: ClassScopeFunctionSpecializationDecl // CHECK-NEXT: CXXMethod{{.*}} 'foo' 'void (int)' // CHECK-NEXT: TemplateArgument{{.*}} 'int' namespace TestTemplateTypeParmDecl { template void foo(); } // CHECK: NamespaceDecl{{.*}} TestTemplateTypeParmDecl // CHECK-NEXT: FunctionTemplateDecl // CHECK-NEXT: TemplateTypeParmDecl{{.*}} typename ... T // CHECK-NEXT: TemplateTypeParmDecl{{.*}} class U // CHECK-NEXT: TemplateArgument type 'int' namespace TestNonTypeTemplateParmDecl { template void foo(); } // CHECK: NamespaceDecl{{.*}} TestNonTypeTemplateParmDecl // CHECK-NEXT: FunctionTemplateDecl // CHECK-NEXT: NonTypeTemplateParmDecl{{.*}} 'int' I // CHECK-NEXT: TemplateArgument expr // CHECK-NEXT: IntegerLiteral{{.*}} 'int' 1 // CHECK-NEXT: NonTypeTemplateParmDecl{{.*}} 'int' ... J namespace TestTemplateTemplateParmDecl { template class A; template