clang 10.0.0git

Nodes.h
Go to the documentation of this file.
1 //===- Nodes.h - syntax nodes for C/C++ grammar constructs ----*- C++ -*-=====//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 // Syntax tree nodes for C, C++ and Objective-C grammar constructs.
9 //
10 // Nodes provide access to their syntactic components, e.g. IfStatement provides
11 // a way to get its condition, then and else branches, tokens for 'if' and
12 // 'else' keywords.
13 // When using the accessors, please assume they can return null. This happens
14 // because:
15 // - the corresponding subnode is optional in the C++ grammar, e.g. an else
16 // branch of an if statement,
17 // - syntactic errors occurred while parsing the corresponding subnode.
18 // One notable exception is "introducer" keywords, e.g. the accessor for the
19 // 'if' keyword of an if statement will never return null.
20 //===----------------------------------------------------------------------===//
21 #ifndef LLVM_CLANG_TOOLING_SYNTAX_NODES_H
22 #define LLVM_CLANG_TOOLING_SYNTAX_NODES_H
23
24 #include "clang/Basic/TokenKinds.h"
25 #include "clang/Lex/Token.h"
26 #include "clang/Tooling/Syntax/Tokens.h"
27 #include "clang/Tooling/Syntax/Tree.h"
28 #include "llvm/ADT/ArrayRef.h"
29 #include "llvm/ADT/StringRef.h"
30 #include "llvm/Support/raw_ostream.h"
31 namespace clang {
32 namespace syntax {
33
34 /// A kind of a syntax node, used for implementing casts. The ordering and
35 /// blocks of enumerator constants must correspond to the inheritance hierarchy
36 /// of syntax::Node.
37 enum class NodeKind : uint16_t {
38 Leaf,
39 TranslationUnit,
40
41 // Expressions
42 UnknownExpression,
43
44 // Statements
45 UnknownStatement,
46 DeclarationStatement,
47 EmptyStatement,
48 SwitchStatement,
49 CaseStatement,
50 DefaultStatement,
51 IfStatement,
52 ForStatement,
53 WhileStatement,
54 ContinueStatement,
55 BreakStatement,
56 ReturnStatement,
57 RangeBasedForStatement,
58 ExpressionStatement,
59 CompoundStatement,
60
61 // Declarations
62 UnknownDeclaration,
63 EmptyDeclaration,
64 StaticAssertDeclaration,
65 LinkageSpecificationDeclaration,
66 SimpleDeclaration,
67 NamespaceDefinition,
68 NamespaceAliasDefinition,
69 UsingNamespaceDirective,
70 UsingDeclaration,
71 TypeAliasDeclaration
72 };
73 /// For debugging purposes.
74 llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, NodeKind K);
75
76 /// A relation between a parent and child node, e.g. 'left-hand-side of
77 /// a binary expression'. Used for implementing accessors.
78 enum class NodeRole : uint8_t {
79 // Roles common to multiple node kinds.
80 /// A node without a parent
81 Detached,
82 /// Children of an unknown semantic nature, e.g. skipped tokens, comments.
83 Unknown,
84 /// An opening parenthesis in argument lists and blocks, e.g. '{', '(', etc.
85 OpenParen,
86 /// A closing parenthesis in argument lists and blocks, e.g. '}', ')', etc.
87 CloseParen,
88 /// A keywords that introduces some grammar construct, e.g. 'if', 'try', etc.
89 IntroducerKeyword,
90 /// An inner statement for those that have only a single child of kind
91 /// statement, e.g. loop body for while, for, etc; inner statement for case,
92 /// default, etc.
93 BodyStatement,
94
95 // Roles specific to particular node kinds.
96 CaseStatement_value,
97 IfStatement_thenStatement,
98 IfStatement_elseKeyword,
99 IfStatement_elseStatement,
100 ReturnStatement_value,
101 ExpressionStatement_expression,
102 CompoundStatement_statement,
103 StaticAssertDeclaration_condition,
104 StaticAssertDeclaration_message
105 };
106 /// For debugging purposes.
107 llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, NodeRole R);
108
109 /// A root node for a translation unit. Parent is always null.
110 class TranslationUnit final : public Tree {
111 public:
112 TranslationUnit() : Tree(NodeKind::TranslationUnit) {}
113 static bool classof(const Node *N) {
114 return N->kind() == NodeKind::TranslationUnit;
115 }
116 };
117
118 /// A base class for all expressions. Note that expressions are not statements,
119 /// even though they are in clang.
120 class Expression : public Tree {
121 public:
122 Expression(NodeKind K) : Tree(K) {}
123 static bool classof(const Node *N) {
124 return NodeKind::UnknownExpression <= N->kind() &&
125 N->kind() <= NodeKind::UnknownExpression;
126 }
127 };
128
129 /// An expression of an unknown kind, i.e. one not currently handled by the
130 /// syntax tree.
131 class UnknownExpression final : public Expression {
132 public:
133 UnknownExpression() : Expression(NodeKind::UnknownExpression) {}
134 static bool classof(const Node *N) {
135 return N->kind() == NodeKind::UnknownExpression;
136 }
137 };
138
139 /// An abstract node for C++ statements, e.g. 'while', 'if', etc.
140 /// FIXME: add accessors for semicolon of statements that have it.
141 class Statement : public Tree {
142 public:
143 Statement(NodeKind K) : Tree(K) {}
144 static bool classof(const Node *N) {
145 return NodeKind::UnknownStatement <= N->kind() &&
146 N->kind() <= NodeKind::CompoundStatement;
147 }
148 };
149
150 /// A statement of an unknown kind, i.e. one not currently handled by the syntax
151 /// tree.
152 class UnknownStatement final : public Statement {
153 public:
154 UnknownStatement() : Statement(NodeKind::UnknownStatement) {}
155 static bool classof(const Node *N) {
156 return N->kind() == NodeKind::UnknownStatement;
157 }
158 };
159
160 /// E.g. 'int a, b = 10;'
161 class DeclarationStatement final : public Statement {
162 public:
163 DeclarationStatement() : Statement(NodeKind::DeclarationStatement) {}
164 static bool classof(const Node *N) {
165 return N->kind() == NodeKind::DeclarationStatement;
166 }
167 };
168
169 /// The no-op statement, i.e. ';'.
170 class EmptyStatement final : public Statement {
171 public:
172 EmptyStatement() : Statement(NodeKind::EmptyStatement) {}
173 static bool classof(const Node *N) {
174 return N->kind() == NodeKind::EmptyStatement;
175 }
176 };
177
178 /// switch (<cond>) <body>
179 class SwitchStatement final : public Statement {
180 public:
181 SwitchStatement() : Statement(NodeKind::SwitchStatement) {}
182 static bool classof(const Node *N) {
183 return N->kind() == NodeKind::SwitchStatement;
184 }
185 syntax::Leaf *switchKeyword();
186 syntax::Statement *body();
187 };
188
189 /// case <value>: <body>
190 class CaseStatement final : public Statement {
191 public:
192 CaseStatement() : Statement(NodeKind::CaseStatement) {}
193 static bool classof(const Node *N) {
194 return N->kind() == NodeKind::CaseStatement;
195 }
196 syntax::Leaf *caseKeyword();
197 syntax::Expression *value();
198 syntax::Statement *body();
199 };
200
201 /// default: <body>
202 class DefaultStatement final : public Statement {
203 public:
204 DefaultStatement() : Statement(NodeKind::DefaultStatement) {}
205 static bool classof(const Node *N) {
206 return N->kind() == NodeKind::DefaultStatement;
207 }
208 syntax::Leaf *defaultKeyword();
209 syntax::Statement *body();
210 };
211
212 /// if (cond) <then-statement> else <else-statement>
213 /// FIXME: add condition that models 'expression or variable declaration'
214 class IfStatement final : public Statement {
215 public:
216 IfStatement() : Statement(NodeKind::IfStatement) {}
217 static bool classof(const Node *N) {
218 return N->kind() == NodeKind::IfStatement;
219 }
220 syntax::Leaf *ifKeyword();
221 syntax::Statement *thenStatement();
222 syntax::Leaf *elseKeyword();
223 syntax::Statement *elseStatement();
224 };
225
226 /// for (<init>; <cond>; <increment>) <body>
227 class ForStatement final : public Statement {
228 public:
229 ForStatement() : Statement(NodeKind::ForStatement) {}
230 static bool classof(const Node *N) {
231 return N->kind() == NodeKind::ForStatement;
232 }
233 syntax::Leaf *forKeyword();
234 syntax::Statement *body();
235 };
236
237 /// while (<cond>) <body>
238 class WhileStatement final : public Statement {
239 public:
240 WhileStatement() : Statement(NodeKind::WhileStatement) {}
241 static bool classof(const Node *N) {
242 return N->kind() == NodeKind::WhileStatement;
243 }
244 syntax::Leaf *whileKeyword();
245 syntax::Statement *body();
246 };
247
248 /// continue;
249 class ContinueStatement final : public Statement {
250 public:
251 ContinueStatement() : Statement(NodeKind::ContinueStatement) {}
252 static bool classof(const Node *N) {
253 return N->kind() == NodeKind::ContinueStatement;
254 }
255 syntax::Leaf *continueKeyword();
256 };
257
258 /// break;
259 class BreakStatement final : public Statement {
260 public:
261 BreakStatement() : Statement(NodeKind::BreakStatement) {}
262 static bool classof(const Node *N) {
263 return N->kind() == NodeKind::BreakStatement;
264 }
265 syntax::Leaf *breakKeyword();
266 };
267
268 /// return <expr>;
269 /// return;
270 class ReturnStatement final : public Statement {
271 public:
272 ReturnStatement() : Statement(NodeKind::ReturnStatement) {}
273 static bool classof(const Node *N) {
274 return N->kind() == NodeKind::ReturnStatement;
275 }
276 syntax::Leaf *returnKeyword();
277 syntax::Expression *value();
278 };
279
280 /// for (<decl> : <init>) <body>
281 class RangeBasedForStatement final : public Statement {
282 public:
283 RangeBasedForStatement() : Statement(NodeKind::RangeBasedForStatement) {}
284 static bool classof(const Node *N) {
285 return N->kind() == NodeKind::RangeBasedForStatement;
286 }
287 syntax::Leaf *forKeyword();
288 syntax::Statement *body();
289 };
290
291 /// Expression in a statement position, e.g. functions calls inside compound
292 /// statements or inside a loop body.
293 class ExpressionStatement final : public Statement {
294 public:
295 ExpressionStatement() : Statement(NodeKind::ExpressionStatement) {}
296 static bool classof(const Node *N) {
297 return N->kind() == NodeKind::ExpressionStatement;
298 }
299 syntax::Expression *expression();
300 };
301
302 /// { statement1; statement2; … }
303 class CompoundStatement final : public Statement {
304 public:
305 CompoundStatement() : Statement(NodeKind::CompoundStatement) {}
306 static bool classof(const Node *N) {
307 return N->kind() == NodeKind::CompoundStatement;
308 }
309 syntax::Leaf *lbrace();
310 /// FIXME: use custom iterator instead of 'vector'.
311 std::vector<syntax::Statement *> statements();
312 syntax::Leaf *rbrace();
313 };
314
315 /// A declaration that can appear at the top-level. Note that this does *not*
316 /// correspond 1-to-1 to clang::Decl. Syntax trees distinguish between top-level
317 /// declarations (e.g. namespace definitions) and declarators (e.g. variables,
318 /// typedefs, etc.). Declarators are stored inside SimpleDeclaration.
319 class Declaration : public Tree {
320 public:
321 Declaration(NodeKind K) : Tree(K) {}
322 static bool classof(const Node *N) {
323 return NodeKind::UnknownDeclaration <= N->kind() &&
324 N->kind() <= NodeKind::TypeAliasDeclaration;
325 }
326 };
327
328 /// Declaration of an unknown kind, e.g. not yet supported in syntax trees.
329 class UnknownDeclaration final : public Declaration {
330 public:
331 UnknownDeclaration() : Declaration(NodeKind::UnknownDeclaration) {}
332 static bool classof(const Node *N) {
333 return N->kind() == NodeKind::UnknownDeclaration;
334 }
335 };
336
337 /// A semicolon in the top-level context. Does not declare anything.
338 class EmptyDeclaration final : public Declaration {
339 public:
340 EmptyDeclaration() : Declaration(NodeKind::EmptyDeclaration) {}
341 static bool classof(const Node *N) {
342 return N->kind() == NodeKind::EmptyDeclaration;
343 }
344 };
345
346 /// static_assert(<condition>, <message>)
347 /// static_assert(<condition>)
348 class StaticAssertDeclaration final : public Declaration {
349 public:
350 StaticAssertDeclaration() : Declaration(NodeKind::StaticAssertDeclaration) {}
351 static bool classof(const Node *N) {
352 return N->kind() == NodeKind::StaticAssertDeclaration;
353 }
354 syntax::Expression *condition();
355 syntax::Expression *message();
356 };
357
358 /// extern <string-literal> declaration
359 /// extern <string-literal> { <decls> }
360 class LinkageSpecificationDeclaration final : public Declaration {
361 public:
362 LinkageSpecificationDeclaration()
363 : Declaration(NodeKind::LinkageSpecificationDeclaration) {}
364 static bool classof(const Node *N) {
365 return N->kind() == NodeKind::LinkageSpecificationDeclaration;
366 }
367 };
368
369 /// Groups multiple declarators (e.g. variables, typedefs, etc.) together. All
370 /// grouped declarators share the same declaration specifiers (e.g. 'int' or
371 /// 'typedef').
372 class SimpleDeclaration final : public Declaration {
373 public:
374 SimpleDeclaration() : Declaration(NodeKind::SimpleDeclaration) {}
375 static bool classof(const Node *N) {
376 return N->kind() == NodeKind::SimpleDeclaration;
377 }
378 };
379
380 /// namespace <name> { <decls> }
381 class NamespaceDefinition final : public Declaration {
382 public:
383 NamespaceDefinition() : Declaration(NodeKind::NamespaceDefinition) {}
384 static bool classof(const Node *N) {
385 return N->kind() == NodeKind::NamespaceDefinition;
386 }
387 };
388
389 /// namespace <name> = <namespace-reference>
390 class NamespaceAliasDefinition final : public Declaration {
391 public:
392 NamespaceAliasDefinition()
393 : Declaration(NodeKind::NamespaceAliasDefinition) {}
394 static bool classof(const Node *N) {
395 return N->kind() == NodeKind::NamespaceAliasDefinition;
396 }
397 };
398
399 /// using namespace <name>
400 class UsingNamespaceDirective final : public Declaration {
401 public:
402 UsingNamespaceDirective() : Declaration(NodeKind::UsingNamespaceDirective) {}
403 static bool classof(const Node *N) {
404 return N->kind() == NodeKind::UsingNamespaceDirective;
405 }
406 };
407
408 /// using <scope>::<name>
409 /// using typename <scope>::<name>
410 class UsingDeclaration final : public Declaration {
411 public:
412 UsingDeclaration() : Declaration(NodeKind::UsingDeclaration) {}
413 static bool classof(const Node *N) {
414 return N->kind() == NodeKind::UsingDeclaration;
415 }
416 };
417
418 /// using <name> = <type>
419 class TypeAliasDeclaration final : public Declaration {
420 public:
421 TypeAliasDeclaration() : Declaration(NodeKind::TypeAliasDeclaration) {}
422 static bool classof(const Node *N) {
423 return N->kind() == NodeKind::TypeAliasDeclaration;
424 }
425 };
426
427 } // namespace syntax
428 } // namespace clang
429 #endif
clang::syntax::WhileStatement
while (<cond>) <body>
Definition: Nodes.h:238
clang::syntax::NodeKind::ReturnStatement
clang::syntax::EmptyDeclaration::classof
static bool classof(const Node *N)
Definition: Nodes.h:341
clang::syntax::SimpleDeclaration::SimpleDeclaration
SimpleDeclaration()
Definition: Nodes.h:374
syntax
clang::syntax::NodeKind::LinkageSpecificationDeclaration
clang::syntax::Statement::classof
static bool classof(const Node *N)
Definition: Nodes.h:144
clang::syntax::NodeRole::OpenParen
An opening parenthesis in argument lists and blocks, e.g. &#39;{&#39;, &#39;(&#39;, etc.
clang::syntax::NodeRole::Unknown
Children of an unknown semantic nature, e.g. skipped tokens, comments.
clang::syntax::NodeKind::EmptyStatement
clang::syntax::CompoundStatement::CompoundStatement
CompoundStatement()
Definition: Nodes.h:305
clang::transformer::expression
Stencil expression(llvm::StringRef Id)
Generates the source of the expression bound to Id, wrapping it in parentheses if it may parse differ...
Definition: Stencil.cpp:315
clang::syntax::CompoundStatement
{ statement1; statement2; … }
Definition: Nodes.h:303
clang::syntax::NodeKind::RangeBasedForStatement
clang::syntax::ReturnStatement::classof
static bool classof(const Node *N)
Definition: Nodes.h:273
clang::syntax::BreakStatement::BreakStatement
BreakStatement()
Definition: Nodes.h:261
clang::syntax::NodeKind::CompoundStatement
clang::syntax::LinkageSpecificationDeclaration::LinkageSpecificationDeclaration
LinkageSpecificationDeclaration()
Definition: Nodes.h:362
clang::syntax::operator<<
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, NodeKind K)
For debugging purposes.
Definition: Nodes.cpp:13
clang::syntax::CaseStatement
case : <body>
Definition: Nodes.h:190
clang::syntax::NamespaceAliasDefinition::NamespaceAliasDefinition
NamespaceAliasDefinition()
Definition: Nodes.h:392
clang::syntax::UnknownExpression::classof
static bool classof(const Node *N)
Definition: Nodes.h:134
clang::syntax::CompoundStatement::classof
static bool classof(const Node *N)
Definition: Nodes.h:306
clang::syntax::NodeKind::EmptyDeclaration
clang::syntax::StaticAssertDeclaration
static_assert(<condition>, <message>) static_assert(<condition>)
Definition: Nodes.h:348
clang::syntax::UnknownExpression::UnknownExpression
UnknownExpression()
Definition: Nodes.h:133
clang::syntax::UnknownStatement::UnknownStatement
UnknownStatement()
Definition: Nodes.h:154
clang::syntax::NodeKind::UsingNamespaceDirective
clang::syntax::UnknownExpression
An expression of an unknown kind, i.e.
Definition: Nodes.h:131
clang::syntax::Expression::classof
static bool classof(const Node *N)
Definition: Nodes.h:123
clang::syntax::NodeKind::ContinueStatement
clang::syntax::Node
A node in a syntax tree.
Definition: Tree.h:76
clang::syntax::NodeKind::UnknownDeclaration
clang::syntax::TranslationUnit
A root node for a translation unit. Parent is always null.
Definition: Nodes.h:110
clang::syntax::EmptyStatement::EmptyStatement
EmptyStatement()
Definition: Nodes.h:172
clang::syntax::UnknownDeclaration::UnknownDeclaration
UnknownDeclaration()
Definition: Nodes.h:331
clang::syntax::NodeKind::NamespaceAliasDefinition
clang::syntax::ForStatement
for (<init>; <cond>; <increment>) <body>
Definition: Nodes.h:227
clang::syntax::NodeRole::IfStatement_thenStatement
clang::syntax::RangeBasedForStatement
for (<decl> : <init>) <body>
Definition: Nodes.h:281
clang::syntax::ReturnStatement::ReturnStatement
ReturnStatement()
Definition: Nodes.h:272
clang::syntax::ExpressionStatement::ExpressionStatement
ExpressionStatement()
Definition: Nodes.h:295
clang::syntax::NodeKind::TranslationUnit
clang::syntax::TranslationUnit::TranslationUnit
TranslationUnit()
Definition: Nodes.h:112
clang::syntax::UsingDeclaration
using <scope>::<name> using typename <scope>::<name>
Definition: Nodes.h:410
clang::syntax::SwitchStatement
switch (<cond>) <body>
Definition: Nodes.h:179
clang::syntax::BreakStatement::classof
static bool classof(const Node *N)
Definition: Nodes.h:262
clang::syntax::NodeRole::IfStatement_elseKeyword
clang::syntax::NodeKind::Leaf
clang::syntax::NodeKind::UsingDeclaration
clang::syntax::NodeKind::SwitchStatement
clang::syntax::NodeRole::CompoundStatement_statement
clang::syntax::NodeRole::BodyStatement
An inner statement for those that have only a single child of kind statement, e.g.
clang::syntax::IfStatement
if (cond) <then-statement> else <else-statement> FIXME: add condition that models &#39;expression or vari...
Definition: Nodes.h:214
clang::syntax::LinkageSpecificationDeclaration::classof
static bool classof(const Node *N)
Definition: Nodes.h:364
clang::syntax::NamespaceDefinition::NamespaceDefinition
NamespaceDefinition()
Definition: Nodes.h:383
clang::syntax::NodeKind::BreakStatement
Tree.h
clang::syntax::NodeRole::StaticAssertDeclaration_message
clang::syntax::EmptyDeclaration::EmptyDeclaration
EmptyDeclaration()
Definition: Nodes.h:340
clang::syntax::Statement
An abstract node for C++ statements, e.g.
Definition: Nodes.h:141
clang::syntax::UnknownDeclaration::classof
static bool classof(const Node *N)
Definition: Nodes.h:332
clang::syntax::NamespaceDefinition::classof
static bool classof(const Node *N)
Definition: Nodes.h:384
clang::syntax::DeclarationStatement::classof
static bool classof(const Node *N)
Definition: Nodes.h:164
clang::syntax::ForStatement::ForStatement
ForStatement()
Definition: Nodes.h:229
clang::syntax::SwitchStatement::classof
static bool classof(const Node *N)
Definition: Nodes.h:182
clang::syntax::EmptyDeclaration
A semicolon in the top-level context. Does not declare anything.
Definition: Nodes.h:338
clang::syntax::BreakStatement
break;
Definition: Nodes.h:259
clang::syntax::EmptyStatement
The no-op statement, i.e. &#39;;&#39;.
Definition: Nodes.h:170
clang::syntax::RangeBasedForStatement::classof
static bool classof(const Node *N)
Definition: Nodes.h:284
clang::syntax::NodeRole::IntroducerKeyword
A keywords that introduces some grammar construct, e.g. &#39;if&#39;, &#39;try&#39;, etc.
clang::syntax::DefaultStatement::classof
static bool classof(const Node *N)
Definition: Nodes.h:205
clang::syntax::UnknownStatement::classof
static bool classof(const Node *N)
Definition: Nodes.h:155
clang::syntax::NamespaceDefinition
namespace <name> { <decls> }
Definition: Nodes.h:381
clang::syntax::CaseStatement::classof
static bool classof(const Node *N)
Definition: Nodes.h:193
clang::syntax::UnknownDeclaration
Declaration of an unknown kind, e.g. not yet supported in syntax trees.
Definition: Nodes.h:329
clang::syntax::NodeKind::ExpressionStatement
clang::syntax::NodeKind::WhileStatement
clang::syntax::WhileStatement::classof
static bool classof(const Node *N)
Definition: Nodes.h:241
clang::syntax::TypeAliasDeclaration::TypeAliasDeclaration
TypeAliasDeclaration()
Definition: Nodes.h:421
clang::syntax::ContinueStatement
continue;
Definition: Nodes.h:249
clang::syntax::NodeKind::ForStatement
clang::syntax::NodeKind::IfStatement
clang::syntax::NodeKind::UnknownStatement
clang::syntax::NodeKind::NamespaceDefinition
clang::syntax::NodeRole::ExpressionStatement_expression
clang::syntax::NodeKind::DeclarationStatement
clang::syntax::UnknownStatement
A statement of an unknown kind, i.e.
Definition: Nodes.h:152
clang::syntax::NodeRole::CloseParen
A closing parenthesis in argument lists and blocks, e.g. &#39;}&#39;, &#39;)&#39;, etc.
clang::syntax::Tree
A node that has children and represents a syntactic language construct.
Definition: Tree.h:150
clang::syntax::DefaultStatement::DefaultStatement
DefaultStatement()
Definition: Nodes.h:204
clang::syntax::NodeKind
NodeKind
A kind of a syntax node, used for implementing casts.
Definition: Nodes.h:37
clang::syntax::ContinueStatement::ContinueStatement
ContinueStatement()
Definition: Nodes.h:251
clang::syntax::UsingNamespaceDirective
using namespace <name>
Definition: Nodes.h:400
clang::syntax::Declaration::Declaration
Declaration(NodeKind K)
Definition: Nodes.h:321
clang::syntax::NodeKind::StaticAssertDeclaration
clang::syntax::DeclarationStatement
E.g. &#39;int a, b = 10;&#39;.
Definition: Nodes.h:161
clang::syntax::TypeAliasDeclaration
using <name> = <type>
Definition: Nodes.h:419
clang::syntax::Declaration
A declaration that can appear at the top-level.
Definition: Nodes.h:319
clang::syntax::DefaultStatement
default: <body>
Definition: Nodes.h:202
clang::syntax::TypeAliasDeclaration::classof
static bool classof(const Node *N)
Definition: Nodes.h:422
clang::syntax::ReturnStatement
return <expr>; return;
Definition: Nodes.h:270
clang::syntax::NodeRole::Detached
A node without a parent.
clang::syntax::CaseStatement::CaseStatement
CaseStatement()
Definition: Nodes.h:192
clang::syntax::NodeRole::StaticAssertDeclaration_condition
clang::syntax::Expression::Expression
Expression(NodeKind K)
Definition: Nodes.h:122
clang::syntax::UsingDeclaration::classof
static bool classof(const Node *N)
Definition: Nodes.h:413
clang::syntax::ExpressionStatement
Expression in a statement position, e.g.
Definition: Nodes.h:293
clang::syntax::UsingNamespaceDirective::classof
static bool classof(const Node *N)
Definition: Nodes.h:403
clang::syntax::NodeRole
NodeRole
A relation between a parent and child node, e.g.
Definition: Nodes.h:78
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:21
clang::syntax::NamespaceAliasDefinition::classof
static bool classof(const Node *N)
Definition: Nodes.h:394
clang::syntax::ForStatement::classof
static bool classof(const Node *N)
Definition: Nodes.h:230
clang::syntax::StaticAssertDeclaration::StaticAssertDeclaration
StaticAssertDeclaration()
Definition: Nodes.h:350
clang::syntax::Leaf
A leaf node points to a single token inside the expanded token stream.
Definition: Tree.h:138
clang::syntax::TranslationUnit::classof
static bool classof(const Node *N)
Definition: Nodes.h:113
Tokens.h
clang::syntax::Declaration::classof
static bool classof(const Node *N)
Definition: Nodes.h:322
clang::syntax::EmptyStatement::classof
static bool classof(const Node *N)
Definition: Nodes.h:173
clang::syntax::LinkageSpecificationDeclaration
extern <string-literal> declaration extern <string-literal> { <decls> }
Definition: Nodes.h:360
clang::syntax::Expression
A base class for all expressions.
Definition: Nodes.h:120
clang::syntax::NodeRole::IfStatement_elseStatement
clang::syntax::IfStatement::IfStatement
IfStatement()
Definition: Nodes.h:216
clang::syntax::NodeRole::ReturnStatement_value
clang::syntax::StaticAssertDeclaration::classof
static bool classof(const Node *N)
Definition: Nodes.h:351
clang::syntax::Statement::Statement
Statement(NodeKind K)
Definition: Nodes.h:143
clang::syntax::NodeKind::TypeAliasDeclaration
TokenKinds.h
Defines the clang::TokenKind enum and support functions.
clang::syntax::NodeRole::CaseStatement_value
clang::syntax::IfStatement::classof
static bool classof(const Node *N)
Definition: Nodes.h:217
clang::syntax::DeclarationStatement::DeclarationStatement
DeclarationStatement()
Definition: Nodes.h:163
clang::syntax::NamespaceAliasDefinition
namespace <name> = <namespace-reference>
Definition: Nodes.h:390
clang::syntax::SimpleDeclaration::classof
static bool classof(const Node *N)
Definition: Nodes.h:375
clang::syntax::NodeKind::SimpleDeclaration
clang::syntax::NodeKind::CaseStatement
clang::syntax::NodeKind::DefaultStatement
clang::syntax::Node::kind
NodeKind kind() const
Definition: Tree.h:82
clang::syntax::UsingNamespaceDirective::UsingNamespaceDirective
UsingNamespaceDirective()
Definition: Nodes.h:402
clang::syntax::UsingDeclaration::UsingDeclaration
UsingDeclaration()
Definition: Nodes.h:412
clang::syntax::ContinueStatement::classof
static bool classof(const Node *N)
Definition: Nodes.h:252
clang::syntax::SimpleDeclaration
Groups multiple declarators (e.g.
Definition: Nodes.h:372
clang::syntax::WhileStatement::WhileStatement
WhileStatement()
Definition: Nodes.h:240
clang::syntax::SwitchStatement::SwitchStatement
SwitchStatement()
Definition: Nodes.h:181
clang::syntax::ExpressionStatement::classof
static bool classof(const Node *N)
Definition: Nodes.h:296
clang::syntax::RangeBasedForStatement::RangeBasedForStatement
RangeBasedForStatement()
Definition: Nodes.h:283
Token.h
clang::transformer::statements
RangeSelector statements(std::string ID)
Definition: RangeSelector.cpp:261
clang::syntax::NodeKind::UnknownExpression