summaryrefslogtreecommitdiffstats
path: root/test/AST/ast-dump-record-definition-data.cpp
blob: 37ed54b1dee122acc32a72c3d97f9ddd069ce06a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
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;
};