1/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2|* *|
3|* Syntax tree node list *|
4|* *|
5|* Automatically generated file, do not edit! *|
6|* From: Nodes.td *|
7|* *|
8\*===----------------------------------------------------------------------===*/
9
10
11// Forward-declare node types so we don't have to carefully sequence definitions.
12class Node;
13class Leaf;
14class Tree;
15class ArraySubscript;
16class Declaration;
17class EmptyDeclaration;
18class ExplicitTemplateInstantiation;
19class LinkageSpecificationDeclaration;
20class NamespaceAliasDefinition;
21class NamespaceDefinition;
22class SimpleDeclaration;
23class StaticAssertDeclaration;
24class TemplateDeclaration;
25class TypeAliasDeclaration;
26class UnknownDeclaration;
27class UsingDeclaration;
28class UsingNamespaceDirective;
29class Declarator;
30class ParenDeclarator;
31class SimpleDeclarator;
32class Expression;
33class BinaryOperatorExpression;
34class CallExpression;
35class IdExpression;
36class LiteralExpression;
37class BoolLiteralExpression;
38class CharacterLiteralExpression;
39class CxxNullPtrExpression;
40class FloatingLiteralExpression;
41class IntegerLiteralExpression;
42class StringLiteralExpression;
43class UserDefinedLiteralExpression;
44class CharUserDefinedLiteralExpression;
45class FloatUserDefinedLiteralExpression;
46class IntegerUserDefinedLiteralExpression;
47class StringUserDefinedLiteralExpression;
48class MemberExpression;
49class ParenExpression;
50class ThisExpression;
51class UnknownExpression;
52class List;
53class CallArguments;
54class DeclaratorList;
55class NestedNameSpecifier;
56class ParameterDeclarationList;
57class MemberPointer;
58class NameSpecifier;
59class DecltypeNameSpecifier;
60class GlobalNameSpecifier;
61class IdentifierNameSpecifier;
62class SimpleTemplateNameSpecifier;
63class ParametersAndQualifiers;
64class Statement;
65class BreakStatement;
66class CaseStatement;
67class CompoundStatement;
68class ContinueStatement;
69class DeclarationStatement;
70class DefaultStatement;
71class EmptyStatement;
72class ExpressionStatement;
73class ForStatement;
74class IfStatement;
75class RangeBasedForStatement;
76class ReturnStatement;
77class SwitchStatement;
78class UnknownStatement;
79class WhileStatement;
80class TrailingReturnType;
81class TranslationUnit;
82class UnaryOperatorExpression;
83class PostfixUnaryOperatorExpression;
84class PrefixUnaryOperatorExpression;
85class UnqualifiedId;
86
87// Node definitions
88
89/// A base class for all expressions. Note that expressions are not statements,
90/// even though they are in clang.
91class Expression : public Tree {
92protected:
93 Expression(NodeKind K) : Tree(K) {}
94public:
95 static bool classof(const Node *N);
96};
97
98/// A function call. C++ [expr.call]
99/// call-expression:
100/// expression '(' call-arguments ')'
101/// e.g `f(1, '2')` or `this->Base::f()`
102class CallExpression final : public Expression {
103public:
104 CallExpression() : Expression(NodeKind::CallExpression) {}
105 Expression *getCallee() {
106 return llvm::cast_or_null<Expression>(Val: findChild(R: NodeRole::Callee));
107 }
108 const Expression *getCallee() const {
109 return llvm::cast_or_null<Expression>(Val: findChild(R: NodeRole::Callee));
110 }
111 Leaf *getOpenParen() {
112 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::OpenParen));
113 }
114 const Leaf *getOpenParen() const {
115 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::OpenParen));
116 }
117 CallArguments *getArguments() {
118 return llvm::cast_or_null<CallArguments>(Val: findChild(R: NodeRole::Arguments));
119 }
120 const CallArguments *getArguments() const {
121 return llvm::cast_or_null<CallArguments>(Val: findChild(R: NodeRole::Arguments));
122 }
123 Leaf *getCloseParen() {
124 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::CloseParen));
125 }
126 const Leaf *getCloseParen() const {
127 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::CloseParen));
128 }
129 static bool classof(const Node *N);
130};
131
132/// Models an `id-expression`, e.g. `std::vector<int>::size`.
133/// C++ [expr.prim.id]
134/// id-expression:
135/// unqualified-id
136/// qualified-id
137/// qualified-id:
138/// nested-name-specifier template_opt unqualified-id
139class IdExpression final : public Expression {
140public:
141 IdExpression() : Expression(NodeKind::IdExpression) {}
142 NestedNameSpecifier *getQualifier() {
143 return llvm::cast_or_null<NestedNameSpecifier>(Val: findChild(R: NodeRole::Qualifier));
144 }
145 const NestedNameSpecifier *getQualifier() const {
146 return llvm::cast_or_null<NestedNameSpecifier>(Val: findChild(R: NodeRole::Qualifier));
147 }
148 Leaf *getTemplateKeyword() {
149 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::TemplateKeyword));
150 }
151 const Leaf *getTemplateKeyword() const {
152 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::TemplateKeyword));
153 }
154 UnqualifiedId *getUnqualifiedId() {
155 return llvm::cast_or_null<UnqualifiedId>(Val: findChild(R: NodeRole::UnqualifiedId));
156 }
157 const UnqualifiedId *getUnqualifiedId() const {
158 return llvm::cast_or_null<UnqualifiedId>(Val: findChild(R: NodeRole::UnqualifiedId));
159 }
160 static bool classof(const Node *N);
161};
162
163/// Expression for literals. C++ [lex.literal]
164class LiteralExpression : public Expression {
165protected:
166 LiteralExpression(NodeKind K) : Expression(K) {}
167public:
168 static bool classof(const Node *N);
169};
170
171/// Expression for boolean literals. C++ [lex.bool]
172class BoolLiteralExpression final : public LiteralExpression {
173public:
174 BoolLiteralExpression() : LiteralExpression(NodeKind::BoolLiteralExpression) {}
175 Leaf *getLiteralToken() {
176 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::LiteralToken));
177 }
178 const Leaf *getLiteralToken() const {
179 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::LiteralToken));
180 }
181 static bool classof(const Node *N);
182};
183
184/// Expression for character literals. C++ [lex.ccon]
185class CharacterLiteralExpression final : public LiteralExpression {
186public:
187 CharacterLiteralExpression() : LiteralExpression(NodeKind::CharacterLiteralExpression) {}
188 Leaf *getLiteralToken() {
189 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::LiteralToken));
190 }
191 const Leaf *getLiteralToken() const {
192 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::LiteralToken));
193 }
194 static bool classof(const Node *N);
195};
196
197/// Expression for the `nullptr` literal. C++ [lex.nullptr]
198class CxxNullPtrExpression final : public LiteralExpression {
199public:
200 CxxNullPtrExpression() : LiteralExpression(NodeKind::CxxNullPtrExpression) {}
201 Leaf *getLiteralToken() {
202 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::LiteralToken));
203 }
204 const Leaf *getLiteralToken() const {
205 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::LiteralToken));
206 }
207 static bool classof(const Node *N);
208};
209
210/// Expression for floating-point literals. C++ [lex.fcon]
211class FloatingLiteralExpression final : public LiteralExpression {
212public:
213 FloatingLiteralExpression() : LiteralExpression(NodeKind::FloatingLiteralExpression) {}
214 Leaf *getLiteralToken() {
215 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::LiteralToken));
216 }
217 const Leaf *getLiteralToken() const {
218 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::LiteralToken));
219 }
220 static bool classof(const Node *N);
221};
222
223/// Expression for integer literals. C++ [lex.icon]
224class IntegerLiteralExpression final : public LiteralExpression {
225public:
226 IntegerLiteralExpression() : LiteralExpression(NodeKind::IntegerLiteralExpression) {}
227 Leaf *getLiteralToken() {
228 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::LiteralToken));
229 }
230 const Leaf *getLiteralToken() const {
231 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::LiteralToken));
232 }
233 static bool classof(const Node *N);
234};
235
236/// Expression for string-literals. C++ [lex.string]
237class StringLiteralExpression final : public LiteralExpression {
238public:
239 StringLiteralExpression() : LiteralExpression(NodeKind::StringLiteralExpression) {}
240 Leaf *getLiteralToken() {
241 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::LiteralToken));
242 }
243 const Leaf *getLiteralToken() const {
244 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::LiteralToken));
245 }
246 static bool classof(const Node *N);
247};
248
249/// Expression for user-defined literal. C++ [lex.ext]
250/// user-defined-literal:
251/// user-defined-integer-literal
252/// user-defined-floating-point-literal
253/// user-defined-string-literal
254/// user-defined-character-literal
255class UserDefinedLiteralExpression : public LiteralExpression {
256protected:
257 UserDefinedLiteralExpression(NodeKind K) : LiteralExpression(K) {}
258public:
259 static bool classof(const Node *N);
260};
261
262/// Expression for user-defined-character-literal. C++ [lex.ext]
263class CharUserDefinedLiteralExpression final : public UserDefinedLiteralExpression {
264public:
265 CharUserDefinedLiteralExpression() : UserDefinedLiteralExpression(NodeKind::CharUserDefinedLiteralExpression) {}
266 Leaf *getLiteralToken() {
267 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::LiteralToken));
268 }
269 const Leaf *getLiteralToken() const {
270 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::LiteralToken));
271 }
272 static bool classof(const Node *N);
273};
274
275/// Expression for user-defined-floating-point-literal. C++ [lex.ext]
276class FloatUserDefinedLiteralExpression final : public UserDefinedLiteralExpression {
277public:
278 FloatUserDefinedLiteralExpression() : UserDefinedLiteralExpression(NodeKind::FloatUserDefinedLiteralExpression) {}
279 Leaf *getLiteralToken() {
280 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::LiteralToken));
281 }
282 const Leaf *getLiteralToken() const {
283 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::LiteralToken));
284 }
285 static bool classof(const Node *N);
286};
287
288/// Expression for user-defined-integer-literal. C++ [lex.ext]
289class IntegerUserDefinedLiteralExpression final : public UserDefinedLiteralExpression {
290public:
291 IntegerUserDefinedLiteralExpression() : UserDefinedLiteralExpression(NodeKind::IntegerUserDefinedLiteralExpression) {}
292 Leaf *getLiteralToken() {
293 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::LiteralToken));
294 }
295 const Leaf *getLiteralToken() const {
296 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::LiteralToken));
297 }
298 static bool classof(const Node *N);
299};
300
301/// Expression for user-defined-string-literal. C++ [lex.ext]
302class StringUserDefinedLiteralExpression final : public UserDefinedLiteralExpression {
303public:
304 StringUserDefinedLiteralExpression() : UserDefinedLiteralExpression(NodeKind::StringUserDefinedLiteralExpression) {}
305 Leaf *getLiteralToken() {
306 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::LiteralToken));
307 }
308 const Leaf *getLiteralToken() const {
309 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::LiteralToken));
310 }
311 static bool classof(const Node *N);
312};
313
314/// Models a class member access. C++ [expr.ref]
315/// member-expression:
316/// expression -> template_opt id-expression
317/// expression . template_opt id-expression
318/// e.g. `x.a`, `xp->a`
319///
320/// Note: An implicit member access inside a class, i.e. `a` instead of
321/// `this->a`, is an `id-expression`.
322class MemberExpression final : public Expression {
323public:
324 MemberExpression() : Expression(NodeKind::MemberExpression) {}
325 Expression *getObject() {
326 return llvm::cast_or_null<Expression>(Val: findChild(R: NodeRole::Object));
327 }
328 const Expression *getObject() const {
329 return llvm::cast_or_null<Expression>(Val: findChild(R: NodeRole::Object));
330 }
331 Leaf *getAccessToken() {
332 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::AccessToken));
333 }
334 const Leaf *getAccessToken() const {
335 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::AccessToken));
336 }
337 Leaf *getTemplateKeyword() {
338 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::TemplateKeyword));
339 }
340 const Leaf *getTemplateKeyword() const {
341 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::TemplateKeyword));
342 }
343 IdExpression *getMember() {
344 return llvm::cast_or_null<IdExpression>(Val: findChild(R: NodeRole::Member));
345 }
346 const IdExpression *getMember() const {
347 return llvm::cast_or_null<IdExpression>(Val: findChild(R: NodeRole::Member));
348 }
349 static bool classof(const Node *N);
350};
351
352/// Models a parenthesized expression `(E)`. C++ [expr.prim.paren]
353/// e.g. `(3 + 2)` in `a = 1 + (3 + 2);`
354class ParenExpression final : public Expression {
355public:
356 ParenExpression() : Expression(NodeKind::ParenExpression) {}
357 Leaf *getOpenParen() {
358 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::OpenParen));
359 }
360 const Leaf *getOpenParen() const {
361 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::OpenParen));
362 }
363 Expression *getSubExpression() {
364 return llvm::cast_or_null<Expression>(Val: findChild(R: NodeRole::SubExpression));
365 }
366 const Expression *getSubExpression() const {
367 return llvm::cast_or_null<Expression>(Val: findChild(R: NodeRole::SubExpression));
368 }
369 Leaf *getCloseParen() {
370 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::CloseParen));
371 }
372 const Leaf *getCloseParen() const {
373 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::CloseParen));
374 }
375 static bool classof(const Node *N);
376};
377
378/// Models a this expression `this`. C++ [expr.prim.this]
379class ThisExpression final : public Expression {
380public:
381 ThisExpression() : Expression(NodeKind::ThisExpression) {}
382 Leaf *getIntroducerKeyword() {
383 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::IntroducerKeyword));
384 }
385 const Leaf *getIntroducerKeyword() const {
386 return llvm::cast_or_null<Leaf>(Val: findChild(R: NodeRole::IntroducerKeyword));
387 }
388 static bool classof(const Node *N);
389};
390
391/// A sequence of these specifiers make a `nested-name-specifier`.
392/// e.g. the `std` or `vector<int>` in `std::vector<int>::size`.
393class NameSpecifier : public Tree {
394protected:
395 NameSpecifier(NodeKind K) : Tree(K) {}
396public:
397 static bool classof(const Node *N);
398};
399
400/// A name specifier holding a decltype, of the form: `decltype ( expression ) `
401/// e.g. the `decltype(s)` in `decltype(s)::size`.
402class DecltypeNameSpecifier final : public NameSpecifier {
403public:
404 DecltypeNameSpecifier() : NameSpecifier(NodeKind::DecltypeNameSpecifier) {}
405 static bool classof(const Node *N);
406};
407
408/// The global namespace name specifier, this specifier doesn't correspond to a
409/// token instead an absence of tokens before a `::` characterizes it, in
410/// `::std::vector<int>` it would be characterized by the absence of a token
411/// before the first `::`
412class GlobalNameSpecifier final : public NameSpecifier {
413public:
414 GlobalNameSpecifier() : NameSpecifier(NodeKind::GlobalNameSpecifier) {}
415 static bool classof(const Node *N);
416};
417
418/// A identifier name specifier, of the form `identifier`
419/// e.g. the `std` in `std::vector<int>::size`.
420class IdentifierNameSpecifier final : public NameSpecifier {
421public:
422 IdentifierNameSpecifier() : NameSpecifier(NodeKind::IdentifierNameSpecifier) {}
423 static bool classof(const Node *N);
424};
425
426/// A name specifier with a simple-template-id, of the form `template_opt
427/// identifier < template-args >` e.g. the `vector<int>` in
428/// `std::vector<int>::size`.
429class SimpleTemplateNameSpecifier final : public NameSpecifier {
430public:
431 SimpleTemplateNameSpecifier() : NameSpecifier(NodeKind::SimpleTemplateNameSpecifier) {}
432 static bool classof(const Node *N);
433};
434
435/// A root node for a translation unit. Parent is always null.
436class TranslationUnit final : public Tree {
437public:
438 TranslationUnit() : Tree(NodeKind::TranslationUnit) {}
439 static bool classof(const Node *N);
440};
441
442