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. |
12 | class Node; |
13 | class Leaf; |
14 | class Tree; |
15 | class ArraySubscript; |
16 | class Declaration; |
17 | class EmptyDeclaration; |
18 | class ExplicitTemplateInstantiation; |
19 | class LinkageSpecificationDeclaration; |
20 | class NamespaceAliasDefinition; |
21 | class NamespaceDefinition; |
22 | class SimpleDeclaration; |
23 | class StaticAssertDeclaration; |
24 | class TemplateDeclaration; |
25 | class TypeAliasDeclaration; |
26 | class UnknownDeclaration; |
27 | class UsingDeclaration; |
28 | class UsingNamespaceDirective; |
29 | class Declarator; |
30 | class ParenDeclarator; |
31 | class SimpleDeclarator; |
32 | class Expression; |
33 | class BinaryOperatorExpression; |
34 | class CallExpression; |
35 | class IdExpression; |
36 | class LiteralExpression; |
37 | class BoolLiteralExpression; |
38 | class CharacterLiteralExpression; |
39 | class CxxNullPtrExpression; |
40 | class FloatingLiteralExpression; |
41 | class IntegerLiteralExpression; |
42 | class StringLiteralExpression; |
43 | class UserDefinedLiteralExpression; |
44 | class CharUserDefinedLiteralExpression; |
45 | class FloatUserDefinedLiteralExpression; |
46 | class IntegerUserDefinedLiteralExpression; |
47 | class StringUserDefinedLiteralExpression; |
48 | class MemberExpression; |
49 | class ParenExpression; |
50 | class ThisExpression; |
51 | class UnknownExpression; |
52 | class List; |
53 | class CallArguments; |
54 | class DeclaratorList; |
55 | class NestedNameSpecifier; |
56 | class ParameterDeclarationList; |
57 | class MemberPointer; |
58 | class NameSpecifier; |
59 | class DecltypeNameSpecifier; |
60 | class GlobalNameSpecifier; |
61 | class IdentifierNameSpecifier; |
62 | class SimpleTemplateNameSpecifier; |
63 | class ParametersAndQualifiers; |
64 | class Statement; |
65 | class BreakStatement; |
66 | class CaseStatement; |
67 | class CompoundStatement; |
68 | class ContinueStatement; |
69 | class DeclarationStatement; |
70 | class DefaultStatement; |
71 | class EmptyStatement; |
72 | class ExpressionStatement; |
73 | class ForStatement; |
74 | class IfStatement; |
75 | class RangeBasedForStatement; |
76 | class ReturnStatement; |
77 | class SwitchStatement; |
78 | class UnknownStatement; |
79 | class WhileStatement; |
80 | class TrailingReturnType; |
81 | class TranslationUnit; |
82 | class UnaryOperatorExpression; |
83 | class PostfixUnaryOperatorExpression; |
84 | class PrefixUnaryOperatorExpression; |
85 | class 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. |
91 | class Expression : public Tree { |
92 | protected: |
93 | Expression(NodeKind K) : Tree(K) {} |
94 | public: |
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()` |
102 | class CallExpression final : public Expression { |
103 | public: |
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 |
139 | class IdExpression final : public Expression { |
140 | public: |
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] |
164 | class LiteralExpression : public Expression { |
165 | protected: |
166 | LiteralExpression(NodeKind K) : Expression(K) {} |
167 | public: |
168 | static bool classof(const Node *N); |
169 | }; |
170 | |
171 | /// Expression for boolean literals. C++ [lex.bool] |
172 | class BoolLiteralExpression final : public LiteralExpression { |
173 | public: |
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] |
185 | class CharacterLiteralExpression final : public LiteralExpression { |
186 | public: |
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] |
198 | class CxxNullPtrExpression final : public LiteralExpression { |
199 | public: |
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] |
211 | class FloatingLiteralExpression final : public LiteralExpression { |
212 | public: |
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] |
224 | class IntegerLiteralExpression final : public LiteralExpression { |
225 | public: |
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] |
237 | class StringLiteralExpression final : public LiteralExpression { |
238 | public: |
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 |
255 | class UserDefinedLiteralExpression : public LiteralExpression { |
256 | protected: |
257 | UserDefinedLiteralExpression(NodeKind K) : LiteralExpression(K) {} |
258 | public: |
259 | static bool classof(const Node *N); |
260 | }; |
261 | |
262 | /// Expression for user-defined-character-literal. C++ [lex.ext] |
263 | class CharUserDefinedLiteralExpression final : public UserDefinedLiteralExpression { |
264 | public: |
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] |
276 | class FloatUserDefinedLiteralExpression final : public UserDefinedLiteralExpression { |
277 | public: |
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] |
289 | class IntegerUserDefinedLiteralExpression final : public UserDefinedLiteralExpression { |
290 | public: |
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] |
302 | class StringUserDefinedLiteralExpression final : public UserDefinedLiteralExpression { |
303 | public: |
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`. |
322 | class MemberExpression final : public Expression { |
323 | public: |
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);` |
354 | class ParenExpression final : public Expression { |
355 | public: |
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] |
379 | class ThisExpression final : public Expression { |
380 | public: |
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`. |
393 | class NameSpecifier : public Tree { |
394 | protected: |
395 | NameSpecifier(NodeKind K) : Tree(K) {} |
396 | public: |
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`. |
402 | class DecltypeNameSpecifier final : public NameSpecifier { |
403 | public: |
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 `::` |
412 | class GlobalNameSpecifier final : public NameSpecifier { |
413 | public: |
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`. |
420 | class IdentifierNameSpecifier final : public NameSpecifier { |
421 | public: |
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`. |
429 | class SimpleTemplateNameSpecifier final : public NameSpecifier { |
430 | public: |
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. |
436 | class TranslationUnit final : public Tree { |
437 | public: |
438 | TranslationUnit() : Tree(NodeKind::TranslationUnit) {} |
439 | static bool classof(const Node *N); |
440 | }; |
441 | |
442 | |