1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -std=c++17 -ast-dump %s | FileCheck -strict-whitespace %s 2 3 void f() { 4 auto IsNotGenericLambda = [](){}; 5 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <col:29> col:29 implicit class definition 6 // CHECK-NOT: DefinitionData {{.*}}generic{{.*}} 7 // CHECK-NEXT: DefinitionData {{.*}}lambda{{.*}} 8 auto IsGenericLambda = [](auto){}; 9 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <col:26> col:26 implicit class definition 10 // CHECK-NEXT: DefinitionData {{.*}}generic{{.*}}lambda{{.*}} 11 } 12 13 struct CanPassInRegisters { 14 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct CanPassInRegisters definition 15 // CHECK-NEXT: DefinitionData {{.*}}pass_in_registers{{.*}} 16 CanPassInRegisters(const CanPassInRegisters&) = default; 17 }; 18 19 struct CantPassInRegisters { 20 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct CantPassInRegisters definition 21 // CHECK-NOT: DefinitionData {{.*}}pass_in_registers{{.*}} 22 CantPassInRegisters(const CantPassInRegisters&) = delete; 23 }; 24 25 struct IsEmpty { 26 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct IsEmpty definition 27 // CHECK-NEXT: DefinitionData {{.*}}empty{{.*}} 28 }; 29 30 struct IsNotEmpty { 31 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsNotEmpty definition 32 // CHECK-NOT: DefinitionData {{.*}}empty{{.*}} 33 int a; 34 }; 35 36 struct IsAggregate { 37 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsAggregate definition 38 // CHECK-NEXT: DefinitionData {{.*}}aggregate{{.*}} 39 int a; 40 }; 41 42 struct IsNotAggregate { 43 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+4]]:1> line:[[@LINE-1]]:8 struct IsNotAggregate definition 44 // CHECK-NOT: DefinitionData {{.*}}aggregate{{.*}} 45 private: 46 int a; 47 }; 48 49 struct IsStandardLayout { 50 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsStandardLayout definition 51 // CHECK-NEXT: DefinitionData {{.*}}standard_layout{{.*}} 52 void f(); 53 }; 54 55 struct IsNotStandardLayout { 56 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsNotStandardLayout definition 57 // CHECK-NOT: DefinitionData {{.*}}standard_layout{{.*}} 58 virtual void f(); 59 }; 60 61 struct IsTriviallyCopyable { 62 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct IsTriviallyCopyable definition 63 // CHECK-NEXT: DefinitionData {{.*}}trivially_copyable{{.*}} 64 }; 65 66 struct IsNotTriviallyCopyable { 67 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsNotTriviallyCopyable definition 68 // CHECK-NOT: DefinitionData {{.*}}trivially_copyable{{.*}} 69 IsNotTriviallyCopyable(const IsNotTriviallyCopyable&) {} 70 }; 71 72 struct IsPOD { 73 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsPOD definition 74 // CHECK-NEXT: DefinitionData {{.*}}pod{{.*}} 75 int a; 76 }; 77 78 struct IsNotPOD { 79 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsNotPOD definition 80 // CHECK-NOT: DefinitionData {{.*}}pod{{.*}} 81 int &a; 82 }; 83 84 struct IsTrivial { 85 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsTrivial definition 86 // CHECK-NEXT: DefinitionData {{.*}}trivial {{.*}} 87 IsTrivial() = default; 88 }; 89 90 struct IsNotTrivial { 91 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsNotTrivial definition 92 // CHECK-NOT: DefinitionData {{.*}}trivial {{.*}} 93 IsNotTrivial() {} 94 }; 95 96 struct IsPolymorphic { 97 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsPolymorphic definition 98 // CHECK-NEXT: DefinitionData {{.*}}polymorphic{{.*}} 99 virtual void f(); 100 }; 101 102 struct IsNotPolymorphic { 103 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsNotPolymorphic definition 104 // CHECK-NOT: DefinitionData {{.*}}polymorphic{{.*}} 105 void f(); 106 }; 107 108 struct IsAbstract { 109 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsAbstract definition 110 // CHECK-NEXT: DefinitionData {{.*}}abstract{{.*}} 111 virtual void f() = 0; 112 }; 113 114 struct IsNotAbstract { 115 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsNotAbstract definition 116 // CHECK-NOT: DefinitionData {{.*}}abstract{{.*}} 117 virtual void f(); 118 }; 119 120 struct IsLiteral { 121 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsLiteral definition 122 // CHECK-NEXT: DefinitionData {{.*}}literal{{.*}} 123 ~IsLiteral() = default; 124 }; 125 126 struct IsNotLiteral { 127 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsNotLiteral definition 128 // CHECK-NOT: DefinitionData {{.*}}literal{{.*}} 129 ~IsNotLiteral() {} 130 }; 131 132 struct HasUserDeclaredConstructor { 133 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct HasUserDeclaredConstructor definition 134 // CHECK-NEXT: DefinitionData {{.*}}has_user_declared_ctor{{.*}} 135 HasUserDeclaredConstructor() {} 136 }; 137 138 struct HasNoUserDeclaredConstructor { 139 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct HasNoUserDeclaredConstructor definition 140 // CHECK-NOT: DefinitionData {{.*}}has_user_declared_ctor{{.*}} 141 }; 142 143 struct HasConstexprNonCopyMoveConstructor { 144 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct HasConstexprNonCopyMoveConstructor definition 145 // CHECK-NEXT: DefinitionData {{.*}}has_constexpr_non_copy_move_ctor{{.*}} 146 constexpr HasConstexprNonCopyMoveConstructor() {} 147 }; 148 149 struct HasNoConstexprNonCopyMoveConstructor { 150 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct HasNoConstexprNonCopyMoveConstructor definition 151 // CHECK-NOT: DefinitionData {{.*}}has_constexpr_non_copy_move_ctor{{.*}} 152 HasNoConstexprNonCopyMoveConstructor() {} 153 }; 154 155 struct HasMutableFields { 156 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct HasMutableFields definition 157 // CHECK-NEXT: DefinitionData {{.*}}has_mutable_fields{{.*}} 158 mutable int i; 159 }; 160 161 struct HasNoMutableFields { 162 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct HasNoMutableFields definition 163 // CHECK-NOT: DefinitionData {{.*}}has_mutable_fields{{.*}} 164 int i; 165 }; 166 167 struct HasVariantMembers { 168 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+5]]:1> line:[[@LINE-1]]:8 struct HasVariantMembers definition 169 // CHECK-NEXT: DefinitionData {{.*}}has_variant_members{{.*}} 170 union { 171 int i; 172 }; 173 }; 174 175 struct HasNoVariantMembers { 176 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct HasNoVariantMembers definition 177 // CHECK-NOT: DefinitionData {{.*}}has_variant_members{{.*}} 178 }; 179 180 struct AllowsConstDefaultInit { 181 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct AllowsConstDefaultInit definition 182 // CHECK-NEXT: DefinitionData {{.*}}can_const_default_init{{.*}} 183 int i = 12; 184 }; 185 186 struct DoesNotAllowConstDefaultInit { 187 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotAllowConstDefaultInit definition 188 // CHECK-NOT: DefinitionData {{.*}}can_const_default_init{{.*}} 189 int i; 190 }; 191