1 // Test without serialization:
2 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -std=c++17 -ast-dump %s \
3 // RUN: | FileCheck -strict-whitespace %s
5 // Test with serialization:
6 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -std=c++17 -emit-pch -o %t %s
7 // RUN: %clang_cc1 -x c++ -triple x86_64-unknown-unknown -std=c++17 -include-pch %t -ast-dump-all /dev/null \
8 // RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
9 // RUN: | FileCheck -strict-whitespace %s
12 auto IsNotGenericLambda
= [](){};
13 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <col:29> col:29 implicit class definition
14 // CHECK-NOT: DefinitionData {{.*}}generic{{.*}}
15 // CHECK-NEXT: DefinitionData {{.*}}lambda{{.*}}
16 auto IsGenericLambda
= [](auto){};
17 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <col:26> col:26 implicit class definition
18 // CHECK-NEXT: DefinitionData {{.*}}generic{{.*}}lambda{{.*}}
21 struct CanPassInRegisters
{
22 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct CanPassInRegisters definition
23 // CHECK-NEXT: DefinitionData {{.*}}pass_in_registers{{.*}}
24 CanPassInRegisters(const CanPassInRegisters
&) = default;
27 struct CantPassInRegisters
{
28 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct CantPassInRegisters definition
29 // CHECK-NOT: DefinitionData {{.*}}pass_in_registers{{.*}}
30 CantPassInRegisters(const CantPassInRegisters
&) = delete;
34 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct IsEmpty definition
35 // CHECK-NEXT: DefinitionData {{.*}}empty{{.*}}
39 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsNotEmpty definition
40 // CHECK-NOT: DefinitionData {{.*}}empty{{.*}}
45 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsAggregate definition
46 // CHECK-NEXT: DefinitionData {{.*}}aggregate{{.*}}
50 struct IsNotAggregate
{
51 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+4]]:1> line:[[@LINE-1]]:8 struct IsNotAggregate definition
52 // CHECK-NOT: DefinitionData {{.*}}aggregate{{.*}}
57 struct IsStandardLayout
{
58 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsStandardLayout definition
59 // CHECK-NEXT: DefinitionData {{.*}}standard_layout{{.*}}
63 struct IsNotStandardLayout
{
64 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsNotStandardLayout definition
65 // CHECK-NOT: DefinitionData {{.*}}standard_layout{{.*}}
69 struct IsTriviallyCopyable
{
70 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct IsTriviallyCopyable definition
71 // CHECK-NEXT: DefinitionData {{.*}}trivially_copyable{{.*}}
74 struct IsNotTriviallyCopyable
{
75 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsNotTriviallyCopyable definition
76 // CHECK-NOT: DefinitionData {{.*}}trivially_copyable{{.*}}
77 IsNotTriviallyCopyable(const IsNotTriviallyCopyable
&) {}
81 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsPOD definition
82 // CHECK-NEXT: DefinitionData {{.*}}pod{{.*}}
87 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsNotPOD definition
88 // CHECK-NOT: DefinitionData {{.*}}pod{{.*}}
93 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsTrivial definition
94 // CHECK-NEXT: DefinitionData {{.*}}trivial {{.*}}
95 IsTrivial() = default;
99 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsNotTrivial definition
100 // CHECK-NOT: DefinitionData {{.*}}trivial {{.*}}
104 struct IsPolymorphic
{
105 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsPolymorphic definition
106 // CHECK-NEXT: DefinitionData {{.*}}polymorphic{{.*}}
110 struct IsNotPolymorphic
{
111 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsNotPolymorphic definition
112 // CHECK-NOT: DefinitionData {{.*}}polymorphic{{.*}}
117 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsAbstract definition
118 // CHECK-NEXT: DefinitionData {{.*}}abstract{{.*}}
119 virtual void f() = 0;
122 struct IsNotAbstract
{
123 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsNotAbstract definition
124 // CHECK-NOT: DefinitionData {{.*}}abstract{{.*}}
129 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsLiteral definition
130 // CHECK-NEXT: DefinitionData {{.*}}literal{{.*}}
131 ~IsLiteral() = default;
134 struct IsNotLiteral
{
135 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct IsNotLiteral definition
136 // CHECK-NOT: DefinitionData {{.*}}literal{{.*}}
140 struct HasUserDeclaredConstructor
{
141 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct HasUserDeclaredConstructor definition
142 // CHECK-NEXT: DefinitionData {{.*}}has_user_declared_ctor{{.*}}
143 HasUserDeclaredConstructor() {}
146 struct HasNoUserDeclaredConstructor
{
147 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct HasNoUserDeclaredConstructor definition
148 // CHECK-NOT: DefinitionData {{.*}}has_user_declared_ctor{{.*}}
151 struct HasConstexprNonCopyMoveConstructor
{
152 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct HasConstexprNonCopyMoveConstructor definition
153 // CHECK-NEXT: DefinitionData {{.*}}has_constexpr_non_copy_move_ctor{{.*}}
154 constexpr HasConstexprNonCopyMoveConstructor() {}
157 struct HasNoConstexprNonCopyMoveConstructor
{
158 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct HasNoConstexprNonCopyMoveConstructor definition
159 // CHECK-NOT: DefinitionData {{.*}}has_constexpr_non_copy_move_ctor{{.*}}
160 HasNoConstexprNonCopyMoveConstructor() {}
163 struct HasMutableFields
{
164 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct HasMutableFields definition
165 // CHECK-NEXT: DefinitionData {{.*}}has_mutable_fields{{.*}}
169 struct HasNoMutableFields
{
170 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct HasNoMutableFields definition
171 // CHECK-NOT: DefinitionData {{.*}}has_mutable_fields{{.*}}
175 struct HasVariantMembers
{
176 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+5]]:1> line:[[@LINE-1]]:8 struct HasVariantMembers definition
177 // CHECK-NEXT: DefinitionData {{.*}}has_variant_members{{.*}}
183 struct HasNoVariantMembers
{
184 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+2]]:1> line:[[@LINE-1]]:8 struct HasNoVariantMembers definition
185 // CHECK-NOT: DefinitionData {{.*}}has_variant_members{{.*}}
188 struct AllowsConstDefaultInit
{
189 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct AllowsConstDefaultInit definition
190 // CHECK-NEXT: DefinitionData {{.*}}can_const_default_init{{.*}}
194 struct DoesNotAllowConstDefaultInit
{
195 // CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotAllowConstDefaultInit definition
196 // CHECK-NOT: DefinitionData {{.*}}can_const_default_init{{.*}}