r348309 - Adding tests for -ast-dump; NFC.
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 4 13:50:08 PST 2018
Author: aaronballman
Date: Tue Dec 4 13:50:08 2018
New Revision: 348309
URL: http://llvm.org/viewvc/llvm-project?rev=348309&view=rev
Log:
Adding tests for -ast-dump; NFC.
This adds tests for the definition data of C++ record objects as well as special member functions.
Added:
cfe/trunk/test/AST/ast-dump-record-definition-data.cpp
cfe/trunk/test/AST/ast-dump-special-member-functions.cpp
Added: cfe/trunk/test/AST/ast-dump-record-definition-data.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/AST/ast-dump-record-definition-data.cpp?rev=348309&view=auto
==============================================================================
--- cfe/trunk/test/AST/ast-dump-record-definition-data.cpp (added)
+++ cfe/trunk/test/AST/ast-dump-record-definition-data.cpp Tue Dec 4 13:50:08 2018
@@ -0,0 +1,190 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -std=c++17 -ast-dump %s | FileCheck -strict-whitespace %s
+
+void f() {
+ auto IsNotGenericLambda = [](){};
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <col:29> col:29 implicit class definition
+ // CHECK-NOT: DefinitionData {{.*}}generic{{.*}}
+ // CHECK-NEXT: DefinitionData {{.*}}lambda{{.*}}
+ auto IsGenericLambda = [](auto){};
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <col:26> col:26 implicit class definition
+ // CHECK-NEXT: DefinitionData {{.*}}generic{{.*}}lambda{{.*}}
+}
+
+struct CanPassInRegisters {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct CanPassInRegisters definition
+ // CHECK-NEXT: DefinitionData {{.*}}pass_in_registers{{.*}}
+ CanPassInRegisters(const CanPassInRegisters&) = default;
+};
+
+struct CantPassInRegisters {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct CantPassInRegisters definition
+ // CHECK-NOT: DefinitionData {{.*}}pass_in_registers{{.*}}
+ CantPassInRegisters(const CantPassInRegisters&) = delete;
+};
+
+struct IsEmpty {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct IsEmpty definition
+ // CHECK-NEXT: DefinitionData {{.*}}empty{{.*}}
+};
+
+struct IsNotEmpty {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsNotEmpty definition
+ // CHECK-NOT: DefinitionData {{.*}}empty{{.*}}
+ int a;
+};
+
+struct IsAggregate {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsAggregate definition
+ // CHECK-NEXT: DefinitionData {{.*}}aggregate{{.*}}
+ int a;
+};
+
+struct IsNotAggregate {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+4]]:1> line:[[@LINE-1]]:8 struct IsNotAggregate definition
+ // CHECK-NOT: DefinitionData {{.*}}aggregate{{.*}}
+private:
+ int a;
+};
+
+struct IsStandardLayout {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsStandardLayout definition
+ // CHECK-NEXT: DefinitionData {{.*}}standard_layout{{.*}}
+ void f();
+};
+
+struct IsNotStandardLayout {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsNotStandardLayout definition
+ // CHECK-NOT: DefinitionData {{.*}}standard_layout{{.*}}
+ virtual void f();
+};
+
+struct IsTriviallyCopyable {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct IsTriviallyCopyable definition
+ // CHECK-NEXT: DefinitionData {{.*}}trivially_copyable{{.*}}
+};
+
+struct IsNotTriviallyCopyable {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsNotTriviallyCopyable definition
+ // CHECK-NOT: DefinitionData {{.*}}trivially_copyable{{.*}}
+ IsNotTriviallyCopyable(const IsNotTriviallyCopyable&) {}
+};
+
+struct IsPOD {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsPOD definition
+ // CHECK-NEXT: DefinitionData {{.*}}pod{{.*}}
+ int a;
+};
+
+struct IsNotPOD {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsNotPOD definition
+ // CHECK-NOT: DefinitionData {{.*}}pod{{.*}}
+ int &a;
+};
+
+struct IsTrivial {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsTrivial definition
+ // CHECK-NEXT: DefinitionData {{.*}}trivial {{.*}}
+ IsTrivial() = default;
+};
+
+struct IsNotTrivial {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsNotTrivial definition
+ // CHECK-NOT: DefinitionData {{.*}}trivial {{.*}}
+ IsNotTrivial() {}
+};
+
+struct IsPolymorphic {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsPolymorphic definition
+ // CHECK-NEXT: DefinitionData {{.*}}polymorphic{{.*}}
+ virtual void f();
+};
+
+struct IsNotPolymorphic {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsNotPolymorphic definition
+ // CHECK-NOT: DefinitionData {{.*}}polymorphic{{.*}}
+ void f();
+};
+
+struct IsAbstract {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsAbstract definition
+ // CHECK-NEXT: DefinitionData {{.*}}abstract{{.*}}
+ virtual void f() = 0;
+};
+
+struct IsNotAbstract {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsNotAbstract definition
+ // CHECK-NOT: DefinitionData {{.*}}abstract{{.*}}
+ virtual void f();
+};
+
+struct IsLiteral {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsLiteral definition
+ // CHECK-NEXT: DefinitionData {{.*}}literal{{.*}}
+ ~IsLiteral() = default;
+};
+
+struct IsNotLiteral {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsNotLiteral definition
+ // CHECK-NOT: DefinitionData {{.*}}literal{{.*}}
+ ~IsNotLiteral() {}
+};
+
+struct HasUserDeclaredConstructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct HasUserDeclaredConstructor definition
+ // CHECK-NEXT: DefinitionData {{.*}}has_user_declared_ctor{{.*}}
+ HasUserDeclaredConstructor() {}
+};
+
+struct HasNoUserDeclaredConstructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct HasNoUserDeclaredConstructor definition
+ // CHECK-NOT: DefinitionData {{.*}}has_user_declared_ctor{{.*}}
+};
+
+struct HasConstexprNonCopyMoveConstructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct HasConstexprNonCopyMoveConstructor definition
+ // CHECK-NEXT: DefinitionData {{.*}}has_constexpr_non_copy_move_ctor{{.*}}
+ constexpr HasConstexprNonCopyMoveConstructor() {}
+};
+
+struct HasNoConstexprNonCopyMoveConstructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct HasNoConstexprNonCopyMoveConstructor definition
+ // CHECK-NOT: DefinitionData {{.*}}has_constexpr_non_copy_move_ctor{{.*}}
+ HasNoConstexprNonCopyMoveConstructor() {}
+};
+
+struct HasMutableFields {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct HasMutableFields definition
+ // CHECK-NEXT: DefinitionData {{.*}}has_mutable_fields{{.*}}
+ mutable int i;
+};
+
+struct HasNoMutableFields {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct HasNoMutableFields definition
+ // CHECK-NOT: DefinitionData {{.*}}has_mutable_fields{{.*}}
+ int i;
+};
+
+struct HasVariantMembers {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+5]]:1> line:[[@LINE-1]]:8 struct HasVariantMembers definition
+ // CHECK-NEXT: DefinitionData {{.*}}has_variant_members{{.*}}
+ union {
+ int i;
+ };
+};
+
+struct HasNoVariantMembers {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct HasNoVariantMembers definition
+ // CHECK-NOT: DefinitionData {{.*}}has_variant_members{{.*}}
+};
+
+struct AllowsConstDefaultInit {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct AllowsConstDefaultInit definition
+ // CHECK-NEXT: DefinitionData {{.*}}can_const_default_init{{.*}}
+ int i = 12;
+};
+
+struct DoesNotAllowConstDefaultInit {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotAllowConstDefaultInit definition
+ // CHECK-NOT: DefinitionData {{.*}}can_const_default_init{{.*}}
+ int i;
+};
Added: cfe/trunk/test/AST/ast-dump-special-member-functions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/AST/ast-dump-special-member-functions.cpp?rev=348309&view=auto
==============================================================================
--- cfe/trunk/test/AST/ast-dump-special-member-functions.cpp (added)
+++ cfe/trunk/test/AST/ast-dump-special-member-functions.cpp Tue Dec 4 13:50:08 2018
@@ -0,0 +1,446 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -std=c++17 -ast-dump %s | FileCheck -strict-whitespace %s
+
+// FIXME: exists
+
+struct TrivialDefaultConstructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <{{.*}}:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct TrivialDefaultConstructor definition
+ // CHECK: DefaultConstructor {{.*}} trivial{{.*}}
+ TrivialDefaultConstructor() = default;
+};
+
+struct NontrivialDefaultConstructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NontrivialDefaultConstructor definition
+ // CHECK: DefaultConstructor {{.*}}non_trivial{{.*}}
+ NontrivialDefaultConstructor() {}
+};
+
+struct UserProvidedDefaultConstructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct UserProvidedDefaultConstructor definition
+ // CHECK: DefaultConstructor {{.*}}user_provided{{.*}}
+ UserProvidedDefaultConstructor() {}
+};
+
+struct NonUserProvidedDefaultConstructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct NonUserProvidedDefaultConstructor definition
+ // CHECK-NOT: DefaultConstructor {{.*}}user_provided{{.*}}
+};
+
+struct HasConstexprDefaultConstructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct HasConstexprDefaultConstructor definition
+ // CHECK: DefaultConstructor {{.*}}constexpr{{.*}}
+ constexpr HasConstexprDefaultConstructor() {}
+};
+
+struct DoesNotHaveConstexprDefaultConstructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotHaveConstexprDefaultConstructor definition
+ // CHECK-NOT: DefaultConstructor {{.*}} constexpr{{.*}}
+ DoesNotHaveConstexprDefaultConstructor() {}
+};
+
+struct NeedsImplicitDefaultConstructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NeedsImplicitDefaultConstructor definition
+ // CHECK: DefaultConstructor {{.*}}needs_implicit{{.*}}
+ int i = 12;
+};
+
+struct DoesNotNeedImplicitDefaultConstructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotNeedImplicitDefaultConstructor definition
+ // CHECK-NOT: DefaultConstructor {{.*}}needs_implicit{{.*}}
+ DoesNotNeedImplicitDefaultConstructor() {}
+};
+
+struct DefaultedDefaultConstructorIsConstexpr {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DefaultedDefaultConstructorIsConstexpr definition
+ // CHECK: DefaultConstructor {{.*}}defaulted_is_constexpr{{.*}}
+ DefaultedDefaultConstructorIsConstexpr() = default;
+};
+
+struct DefaultedDefaultConstructorIsNotConstexpr {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+6]]:1> line:[[@LINE-1]]:8 struct DefaultedDefaultConstructorIsNotConstexpr definition
+ // CHECK-NOT: DefaultConstructor {{.*}}defaulted_is_constexpr{{.*}}
+ DefaultedDefaultConstructorIsNotConstexpr() = default;
+ union {
+ int i;
+ };
+};
+
+struct SimpleCopyConstructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct SimpleCopyConstructor definition
+ // CHECK: CopyConstructor {{.*}}simple{{.*}}
+ int i = 12;
+};
+
+struct NotSimpleCopyConstructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NotSimpleCopyConstructor definition
+ // CHECK-NOT: CopyConstructor {{.*}}simple{{.*}}
+ NotSimpleCopyConstructor(const NotSimpleCopyConstructor&) = delete;
+};
+
+struct TrivialCopyConstructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct TrivialCopyConstructor definition
+ // CHECK: CopyConstructor {{.*}} trivial{{.*}}
+ TrivialCopyConstructor() = default;
+};
+
+struct NontrivialCopyConstructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NontrivialCopyConstructor definition
+ // CHECK: CopyConstructor {{.*}}non_trivial{{.*}}
+ NontrivialCopyConstructor(const NontrivialCopyConstructor&) {}
+};
+
+struct UserDeclaredCopyConstructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct UserDeclaredCopyConstructor definition
+ // CHECK: CopyConstructor {{.*}}user_declared{{.*}}
+ UserDeclaredCopyConstructor(const UserDeclaredCopyConstructor&) {}
+};
+
+struct NonUserDeclaredCopyConstructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct NonUserDeclaredCopyConstructor definition
+ // CHECK-NOT: CopyConstructor {{.*}}user_declared{{.*}}
+};
+
+struct CopyConstructorHasConstParam {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct CopyConstructorHasConstParam definition
+ // CHECK: CopyConstructor {{.*}}has_const_param{{.*}}
+ CopyConstructorHasConstParam(const CopyConstructorHasConstParam&) {}
+};
+
+struct CopyConstructorDoesNotHaveConstParam {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct CopyConstructorDoesNotHaveConstParam definition
+ // CHECK-NOT: CopyConstructor {{.*}} has_const_param{{.*}}
+ CopyConstructorDoesNotHaveConstParam(CopyConstructorDoesNotHaveConstParam&) {}
+};
+
+struct NeedsImplicitCopyConstructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NeedsImplicitCopyConstructor definition
+ // CHECK: CopyConstructor {{.*}}needs_implicit{{.*}}
+ int i = 12;
+};
+
+struct DoesNotNeedImplicitCopyConstructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotNeedImplicitCopyConstructor definition
+ // CHECK-NOT: CopyConstructor {{.*}}needs_implicit{{.*}}
+ DoesNotNeedImplicitCopyConstructor(const DoesNotNeedImplicitCopyConstructor&) {}
+};
+
+struct DeletedDestructor {
+private:
+ ~DeletedDestructor() = delete;
+};
+
+struct CopyConstructorNeedsOverloadResolution : virtual DeletedDestructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct CopyConstructorNeedsOverloadResolution definition
+ // CHECK: CopyConstructor {{.*}}needs_overload_resolution{{.*}}
+};
+
+struct CopyConstructorDoesNotNeedOverloadResolution {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct CopyConstructorDoesNotNeedOverloadResolution definition
+ // CHECK-NOT: CopyConstructor {{.*}}needs_overload_resolution{{.*}}
+};
+
+struct DefaultedCopyConstructorIsDeleted {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+4]]:1> line:[[@LINE-1]]:8 struct DefaultedCopyConstructorIsDeleted definition
+ // CHECK: CopyConstructor {{.*}}defaulted_is_deleted{{.*}}
+ int &&i;
+ DefaultedCopyConstructorIsDeleted(const DefaultedCopyConstructorIsDeleted&) = default;
+};
+
+struct DefaultedCopyConstructorIsNotDeleted {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+4]]:1> line:[[@LINE-1]]:8 struct DefaultedCopyConstructorIsNotDeleted definition
+ // CHECK-NOT: CopyConstructor {{.*}}defaulted_is_deleted{{.*}}
+ int i;
+ DefaultedCopyConstructorIsNotDeleted(const DefaultedCopyConstructorIsNotDeleted&) = default;
+};
+
+struct BaseWithoutCopyConstructorConstParam {
+ BaseWithoutCopyConstructorConstParam(BaseWithoutCopyConstructorConstParam&);
+};
+
+struct ImplicitCopyConstructorHasConstParam {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct ImplicitCopyConstructorHasConstParam definition
+ // CHECK: CopyConstructor {{.*}}implicit_has_const_param{{.*}}
+};
+
+struct ImplicitCopyConstructorDoesNotHaveConstParam : BaseWithoutCopyConstructorConstParam {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct ImplicitCopyConstructorDoesNotHaveConstParam definition
+ // CHECK-NOT: CopyConstructor {{.*}}implicit_has_const_param{{.*}}
+};
+
+struct MoveConstructorExists {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct MoveConstructorExists definition
+ // CHECK: MoveConstructor {{.*}}exists{{.*}}
+};
+
+struct MoveConstructorDoesNotExist {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct MoveConstructorDoesNotExist definition
+ // CHECK-NOT: MoveConstructor {{.*}}exists{{.*}}
+ MoveConstructorDoesNotExist(const MoveConstructorDoesNotExist&);
+};
+
+struct SimpleMoveConstructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct SimpleMoveConstructor definition
+ // CHECK: MoveConstructor {{.*}}simple{{.*}}
+ int i = 12;
+};
+
+struct NotSimpleMoveConstructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NotSimpleMoveConstructor definition
+ // CHECK-NOT: MoveConstructor {{.*}}simple{{.*}}
+ NotSimpleMoveConstructor(NotSimpleMoveConstructor&&) = delete;
+};
+
+struct TrivialMoveConstructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct TrivialMoveConstructor definition
+ // CHECK: MoveConstructor {{.*}} trivial{{.*}}
+ TrivialMoveConstructor() = default;
+};
+
+struct NontrivialMoveConstructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NontrivialMoveConstructor definition
+ // CHECK: MoveConstructor {{.*}}non_trivial{{.*}}
+ NontrivialMoveConstructor(NontrivialMoveConstructor&&) {}
+};
+
+struct UserDeclaredMoveConstructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct UserDeclaredMoveConstructor definition
+ // CHECK: MoveConstructor {{.*}}user_declared{{.*}}
+ UserDeclaredMoveConstructor(UserDeclaredMoveConstructor&&) {}
+};
+
+struct NonUserDeclaredMoveConstructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct NonUserDeclaredMoveConstructor definition
+ // CHECK-NOT: MoveConstructor {{.*}}user_declared{{.*}}
+};
+
+struct NeedsImplicitMoveConstructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NeedsImplicitMoveConstructor definition
+ // CHECK: MoveConstructor {{.*}}needs_implicit{{.*}}
+ int i = 12;
+};
+
+struct DoesNotNeedImplicitMoveConstructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotNeedImplicitMoveConstructor definition
+ // CHECK-NOT: MoveConstructor {{.*}}needs_implicit{{.*}}
+ DoesNotNeedImplicitMoveConstructor(DoesNotNeedImplicitMoveConstructor&&) {}
+};
+
+struct MoveConstructorNeedsOverloadResolution : virtual DeletedDestructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct MoveConstructorNeedsOverloadResolution definition
+ // CHECK: MoveConstructor {{.*}}needs_overload_resolution{{.*}}
+};
+
+struct MoveConstructorDoesNotNeedOverloadResolution {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct MoveConstructorDoesNotNeedOverloadResolution definition
+ // CHECK-NOT: MoveConstructor {{.*}}needs_overload_resolution{{.*}}
+};
+
+// FIXME: defaulted_is_deleted
+
+struct TrivialCopyAssignment {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct TrivialCopyAssignment definition
+ // CHECK: CopyAssignment {{.*}} trivial{{.*}}
+ TrivialCopyAssignment& operator=(const TrivialCopyAssignment&) = default;
+};
+
+struct NontrivialCopyAssignment {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NontrivialCopyAssignment definition
+ // CHECK: CopyAssignment {{.*}}non_trivial{{.*}}
+ NontrivialCopyAssignment& operator=(const NontrivialCopyAssignment&) {}
+};
+
+struct CopyAssignmentHasConstParam {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct CopyAssignmentHasConstParam definition
+ // CHECK: CopyAssignment {{.*}}has_const_param{{.*}}
+ CopyAssignmentHasConstParam& operator=(const CopyAssignmentHasConstParam&) {}
+};
+
+struct CopyAssignmentDoesNotHaveConstParam {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct CopyAssignmentDoesNotHaveConstParam definition
+ // CHECK-NOT: CopyAssignment {{.*}} has_const_param{{.*}}
+ CopyAssignmentDoesNotHaveConstParam& operator=(CopyAssignmentDoesNotHaveConstParam&) {}
+};
+
+struct UserDeclaredCopyAssignment {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct UserDeclaredCopyAssignment definition
+ // CHECK: CopyAssignment {{.*}}user_declared{{.*}}
+ UserDeclaredCopyAssignment& operator=(const UserDeclaredCopyAssignment&) {}
+};
+
+struct NonUserDeclaredCopyAssignment {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct NonUserDeclaredCopyAssignment definition
+ // CHECK-NOT: CopyAssignment {{.*}}user_declared{{.*}}
+};
+
+struct NeedsImplicitCopyAssignment {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NeedsImplicitCopyAssignment definition
+ // CHECK: CopyAssignment {{.*}}needs_implicit{{.*}}
+ int i = 12;
+};
+
+struct DoesNotNeedImplicitCopyAssignment {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotNeedImplicitCopyAssignment definition
+ // CHECK-NOT: CopyAssignment {{.*}}needs_implicit{{.*}}
+ DoesNotNeedImplicitCopyAssignment& operator=(const DoesNotNeedImplicitCopyAssignment&) {}
+};
+
+struct CopyAssignmentNeedsOverloadResolution {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct CopyAssignmentNeedsOverloadResolution definition
+ // CHECK: CopyAssignment {{.*}}needs_overload_resolution{{.*}}
+ mutable int i;
+};
+
+struct CopyAssignmentDoesNotNeedOverloadResolution {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct CopyAssignmentDoesNotNeedOverloadResolution definition
+ // CHECK-NOT: CopyAssignment {{.*}}needs_overload_resolution{{.*}}
+};
+
+struct BaseWithoutCopyAssignmentConstParam {
+ BaseWithoutCopyAssignmentConstParam& operator=(BaseWithoutCopyAssignmentConstParam&);
+};
+
+struct ImplicitCopyAssignmentHasConstParam {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct ImplicitCopyAssignmentHasConstParam definition
+ // CHECK: CopyAssignment {{.*}}implicit_has_const_param{{.*}}
+};
+
+struct ImplicitCopyAssignmentDoesNotHaveConstParam : BaseWithoutCopyAssignmentConstParam {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct ImplicitCopyAssignmentDoesNotHaveConstParam definition
+ // CHECK-NOT: CopyAssignment {{.*}}implicit_has_const_param{{.*}}
+};
+
+struct MoveAssignmentExists {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct MoveAssignmentExists definition
+ // CHECK: MoveAssignment {{.*}}exists{{.*}}
+};
+
+struct MoveAssignmentDoesNotExist {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct MoveAssignmentDoesNotExist definition
+ // CHECK-NOT: MoveAssignment {{.*}}exists{{.*}}
+ MoveAssignmentDoesNotExist& operator=(const MoveAssignmentDoesNotExist&);
+};
+
+struct SimpleMoveAssignment {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct SimpleMoveAssignment definition
+ // CHECK: MoveAssignment {{.*}}simple{{.*}}
+ int i = 12;
+};
+
+struct NotSimpleMoveAssignment {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NotSimpleMoveAssignment definition
+ // CHECK-NOT: MoveAssignment {{.*}}simple{{.*}}
+ NotSimpleMoveAssignment& operator=(NotSimpleMoveAssignment&&) = delete;
+};
+
+struct TrivialMoveAssignment {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct TrivialMoveAssignment definition
+ // CHECK: MoveAssignment {{.*}} trivial{{.*}}
+ TrivialMoveAssignment() = default;
+};
+
+struct NontrivialMoveAssignment {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NontrivialMoveAssignment definition
+ // CHECK: MoveAssignment {{.*}}non_trivial{{.*}}
+ NontrivialMoveAssignment& operator=(NontrivialMoveAssignment&&) {}
+};
+
+struct UserDeclaredMoveAssignment {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct UserDeclaredMoveAssignment definition
+ // CHECK: MoveAssignment {{.*}}user_declared{{.*}}
+ UserDeclaredMoveAssignment& operator=(UserDeclaredMoveAssignment&&) {}
+};
+
+struct NonUserDeclaredMoveAssignment {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct NonUserDeclaredMoveAssignment definition
+ // CHECK-NOT: MoveAssignment {{.*}}user_declared{{.*}}
+};
+
+struct NeedsImplicitMoveAssignment {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NeedsImplicitMoveAssignment definition
+ // CHECK: MoveAssignment {{.*}}needs_implicit{{.*}}
+ int i = 12;
+};
+
+struct DoesNotNeedImplicitMoveAssignment {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotNeedImplicitMoveAssignment definition
+ // CHECK-NOT: MoveAssignment {{.*}}needs_implicit{{.*}}
+ DoesNotNeedImplicitMoveAssignment& operator=(DoesNotNeedImplicitMoveAssignment&&) {}
+};
+
+struct MoveAssignmentNeedsOverloadResolution : virtual DeletedDestructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct MoveAssignmentNeedsOverloadResolution definition
+ // CHECK: MoveAssignment {{.*}}needs_overload_resolution{{.*}}
+};
+
+struct MoveAssignmentDoesNotNeedOverloadResolution {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct MoveAssignmentDoesNotNeedOverloadResolution definition
+ // CHECK-NOT: MoveAssignment {{.*}}needs_overload_resolution{{.*}}
+};
+
+struct SimpleDestructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct SimpleDestructor definition
+ // CHECK: Destructor {{.*}}simple{{.*}}
+};
+
+struct NotSimpleDestructor : DeletedDestructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct NotSimpleDestructor definition
+ // CHECK-NOT: Destructor {{.*}}simple{{.*}}
+};
+
+struct IrrelevantDestructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct IrrelevantDestructor definition
+ // CHECK: Destructor {{.*}}irrelevant{{.*}}
+};
+
+struct RelevantDestructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct RelevantDestructor definition
+ // CHECK-NOT: Destructor {{.*}}irrelevant{{.*}}
+ ~RelevantDestructor() {}
+};
+
+struct TrivialDestructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct TrivialDestructor definition
+ // CHECK: Destructor {{.*}} trivial{{.*}}
+ ~TrivialDestructor() = default;
+};
+
+struct NontrivialDestructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NontrivialDestructor definition
+ // CHECK: Destructor {{.*}}non_trivial{{.*}}
+ ~NontrivialDestructor() {}
+};
+
+struct UserDeclaredDestructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct UserDeclaredDestructor definition
+ // CHECK: Destructor {{.*}}user_declared{{.*}}
+ ~UserDeclaredDestructor() {}
+};
+
+struct NonUserDeclaredDestructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct NonUserDeclaredDestructor definition
+ // CHECK-NOT: Destructor {{.*}}user_declared{{.*}}
+};
+
+struct NeedsImplicitDestructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NeedsImplicitDestructor definition
+ // CHECK: Destructor {{.*}}needs_implicit{{.*}}
+ int i = 12;
+};
+
+struct DoesNotNeedImplicitDestructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotNeedImplicitDestructor definition
+ // CHECK-NOT: Destructor {{.*}}needs_implicit{{.*}}
+ ~DoesNotNeedImplicitDestructor() {}
+};
+
+struct DestructorNeedsOverloadResolution : virtual DeletedDestructor {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DestructorNeedsOverloadResolution definition
+ // CHECK: Destructor {{.*}}needs_overload_resolution{{.*}}
+ ~DestructorNeedsOverloadResolution();
+};
+
+struct DestructorDoesNotNeedOverloadResolution {
+ // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct DestructorDoesNotNeedOverloadResolution definition
+ // CHECK-NOT: Destructor {{.*}}needs_overload_resolution{{.*}}
+};
+
+// FIXME: defaulted_is_deleted
More information about the cfe-commits
mailing list