Coverage Report

Created: 2020-09-22 08:39

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/Tooling/Syntax/Nodes.cpp
Line
Count
Source (jump to first uncovered line)
1
//===- Nodes.cpp ----------------------------------------------*- 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
#include "clang/Tooling/Syntax/Nodes.h"
9
#include "clang/Basic/TokenKinds.h"
10
11
using namespace clang;
12
13
12.5k
raw_ostream &syntax::operator<<(raw_ostream &OS, NodeKind K) {
14
12.5k
  switch (K) {
15
0
  case NodeKind::Leaf:
16
0
    return OS << "Leaf";
17
554
  case NodeKind::TranslationUnit:
18
554
    return OS << "TranslationUnit";
19
312
  case NodeKind::UnknownExpression:
20
312
    return OS << "UnknownExpression";
21
132
  case NodeKind::ParenExpression:
22
132
    return OS << "ParenExpression";
23
40
  case NodeKind::ThisExpression:
24
40
    return OS << "ThisExpression";
25
1.10k
  case NodeKind::IntegerLiteralExpression:
26
1.10k
    return OS << "IntegerLiteralExpression";
27
180
  case NodeKind::CharacterLiteralExpression:
28
180
    return OS << "CharacterLiteralExpression";
29
118
  case NodeKind::FloatingLiteralExpression:
30
118
    return OS << "FloatingLiteralExpression";
31
68
  case NodeKind::StringLiteralExpression:
32
68
    return OS << "StringLiteralExpression";
33
80
  case NodeKind::BoolLiteralExpression:
34
80
    return OS << "BoolLiteralExpression";
35
8
  case NodeKind::CxxNullPtrExpression:
36
8
    return OS << "CxxNullPtrExpression";
37
24
  case NodeKind::IntegerUserDefinedLiteralExpression:
38
24
    return OS << "IntegerUserDefinedLiteralExpression";
39
24
  case NodeKind::FloatUserDefinedLiteralExpression:
40
24
    return OS << "FloatUserDefinedLiteralExpression";
41
8
  case NodeKind::CharUserDefinedLiteralExpression:
42
8
    return OS << "CharUserDefinedLiteralExpression";
43
8
  case NodeKind::StringUserDefinedLiteralExpression:
44
8
    return OS << "StringUserDefinedLiteralExpression";
45
214
  case NodeKind::PrefixUnaryOperatorExpression:
46
214
    return OS << "PrefixUnaryOperatorExpression";
47
38
  case NodeKind::PostfixUnaryOperatorExpression:
48
38
    return OS << "PostfixUnaryOperatorExpression";
49
456
  case NodeKind::BinaryOperatorExpression:
50
456
    return OS << "BinaryOperatorExpression";
51
1.18k
  case NodeKind::UnqualifiedId:
52
1.18k
    return OS << "UnqualifiedId";
53
1.18k
  case NodeKind::IdExpression:
54
1.18k
    return OS << "IdExpression";
55
423
  case NodeKind::CallExpression:
56
423
    return OS << "CallExpression";
57
14
  case NodeKind::UnknownStatement:
58
14
    return OS << "UnknownStatement";
59
42
  case NodeKind::DeclarationStatement:
60
42
    return OS << "DeclarationStatement";
61
36
  case NodeKind::EmptyStatement:
62
36
    return OS << "EmptyStatement";
63
14
  case NodeKind::SwitchStatement:
64
14
    return OS << "SwitchStatement";
65
14
  case NodeKind::CaseStatement:
66
14
    return OS << "CaseStatement";
67
14
  case NodeKind::DefaultStatement:
68
14
    return OS << "DefaultStatement";
69
84
  case NodeKind::IfStatement:
70
84
    return OS << "IfStatement";
71
14
  case NodeKind::ForStatement:
72
14
    return OS << "ForStatement";
73
14
  case NodeKind::WhileStatement:
74
14
    return OS << "WhileStatement";
75
42
  case NodeKind::ContinueStatement:
76
42
    return OS << "ContinueStatement";
77
14
  case NodeKind::BreakStatement:
78
14
    return OS << "BreakStatement";
79
64
  case NodeKind::ReturnStatement:
80
64
    return OS << "ReturnStatement";
81
8
  case NodeKind::RangeBasedForStatement:
82
8
    return OS << "RangeBasedForStatement";
83
148
  case NodeKind::ExpressionStatement:
84
148
    return OS << "ExpressionStatement";
85
310
  case NodeKind::CompoundStatement:
86
310
    return OS << "CompoundStatement";
87
106
  case NodeKind::UnknownDeclaration:
88
106
    return OS << "UnknownDeclaration";
89
14
  case NodeKind::EmptyDeclaration:
90
14
    return OS << "EmptyDeclaration";
91
12
  case NodeKind::StaticAssertDeclaration:
92
12
    return OS << "StaticAssertDeclaration";
93
20
  case NodeKind::LinkageSpecificationDeclaration:
94
20
    return OS << "LinkageSpecificationDeclaration";
95
1.71k
  case NodeKind::SimpleDeclaration:
96
1.71k
    return OS << "SimpleDeclaration";
97
114
  case NodeKind::TemplateDeclaration:
98
114
    return OS << "TemplateDeclaration";
99
20
  case NodeKind::ExplicitTemplateInstantiation:
100
20
    return OS << "ExplicitTemplateInstantiation";
101
44
  case NodeKind::NamespaceDefinition:
102
44
    return OS << "NamespaceDefinition";
103
10
  case NodeKind::NamespaceAliasDefinition:
104
10
    return OS << "NamespaceAliasDefinition";
105
10
  case NodeKind::UsingNamespaceDirective:
106
10
    return OS << "UsingNamespaceDirective";
107
30
  case NodeKind::UsingDeclaration:
108
30
    return OS << "UsingDeclaration";
109
8
  case NodeKind::TypeAliasDeclaration:
110
8
    return OS << "TypeAliasDeclaration";
111
1.49k
  case NodeKind::SimpleDeclarator:
112
1.49k
    return OS << "SimpleDeclarator";
113
136
  case NodeKind::ParenDeclarator:
114
136
    return OS << "ParenDeclarator";
115
72
  case NodeKind::ArraySubscript:
116
72
    return OS << "ArraySubscript";
117
24
  case NodeKind::TrailingReturnType:
118
24
    return OS << "TrailingReturnType";
119
614
  case NodeKind::ParametersAndQualifiers:
120
614
    return OS << "ParametersAndQualifiers";
121
50
  case NodeKind::MemberPointer:
122
50
    return OS << "MemberPointer";
123
0
  case NodeKind::GlobalNameSpecifier:
124
0
    return OS << "GlobalNameSpecifier";
125
8
  case NodeKind::DecltypeNameSpecifier:
126
8
    return OS << "DecltypeNameSpecifier";
127
138
  case NodeKind::IdentifierNameSpecifier:
128
138
    return OS << "IdentifierNameSpecifier";
129
55
  case NodeKind::SimpleTemplateNameSpecifier:
130
55
    return OS << "SimpleTemplateNameSpecifier";
131
191
  case NodeKind::NestedNameSpecifier:
132
191
    return OS << "NestedNameSpecifier";
133
210
  case NodeKind::MemberExpression:
134
210
    return OS << "MemberExpression";
135
102
  case NodeKind::CallArguments:
136
102
    return OS << "CallArguments";
137
318
  case NodeKind::ParameterDeclarationList:
138
318
    return OS << "ParameterDeclarationList";
139
0
  }
140
0
  llvm_unreachable("unknown node kind");
141
0
}
142
143
16.2k
raw_ostream &syntax::operator<<(raw_ostream &OS, NodeRole R) {
144
16.2k
  switch (R) {
145
726
  case syntax::NodeRole::Detached:
146
726
    return OS << "Detached";
147
0
  case syntax::NodeRole::Unknown:
148
0
    return OS << "Unknown";
149
1.66k
  case syntax::NodeRole::OpenParen:
150
1.66k
    return OS << "OpenParen";
151
1.67k
  case syntax::NodeRole::CloseParen:
152
1.67k
    return OS << "CloseParen";
153
428
  case syntax::NodeRole::IntroducerKeyword:
154
428
    return OS << "IntroducerKeyword";
155
1.64k
  case syntax::NodeRole::LiteralToken:
156
1.64k
    return OS << "LiteralToken";
157
24
  case syntax::NodeRole::ArrowToken:
158
24
    return OS << "ArrowToken";
159
10
  case syntax::NodeRole::ExternKeyword:
160
10
    return OS << "ExternKeyword";
161
35
  case syntax::NodeRole::TemplateKeyword:
162
35
    return OS << "TemplateKeyword";
163
78
  case syntax::NodeRole::BodyStatement:
164
78
    return OS << "BodyStatement";
165
819
  case syntax::NodeRole::ListElement:
166
819
    return OS << "ListElement";
167
459
  case syntax::NodeRole::ListDelimiter:
168
459
    return OS << "ListDelimiter";
169
14
  case syntax::NodeRole::CaseValue:
170
14
    return OS << "CaseValue";
171
74
  case syntax::NodeRole::ReturnValue:
172
74
    return OS << "ReturnValue";
173
84
  case syntax::NodeRole::ThenStatement:
174
84
    return OS << "ThenStatement";
175
56
  case syntax::NodeRole::ElseKeyword:
176
56
    return OS << "ElseKeyword";
177
56
  case syntax::NodeRole::ElseStatement:
178
56
    return OS << "ElseStatement";
179
708
  case syntax::NodeRole::OperatorToken:
180
708
    return OS << "OperatorToken";
181
252
  case syntax::NodeRole::Operand:
182
252
    return OS << "Operand";
183
470
  case syntax::NodeRole::LeftHandSide:
184
470
    return OS << "LeftHandSide";
185
470
  case syntax::NodeRole::RightHandSide:
186
470
    return OS << "RightHandSide";
187
1.43k
  case syntax::NodeRole::Expression:
188
1.43k
    return OS << "Expression";
189
416
  case syntax::NodeRole::Statement:
190
416
    return OS << "Statement";
191
12
  case syntax::NodeRole::Condition:
192
12
    return OS << "Condition";
193
8
  case syntax::NodeRole::Message:
194
8
    return OS << "Message";
195
1.49k
  case syntax::NodeRole::Declarator:
196
1.49k
    return OS << "Declarator";
197
134
  case syntax::NodeRole::Declaration:
198
134
    return OS << "Declaration";
199
58
  case syntax::NodeRole::Size:
200
58
    return OS << "Size";
201
318
  case syntax::NodeRole::Parameters:
202
318
    return OS << "Parameters";
203
24
  case syntax::NodeRole::TrailingReturn:
204
24
    return OS << "TrailingReturn";
205
1.18k
  case syntax::NodeRole::UnqualifiedId:
206
1.18k
    return OS << "UnqualifiedId";
207
93
  case syntax::NodeRole::Qualifier:
208
93
    return OS << "Qualifier";
209
118
  case syntax::NodeRole::SubExpression:
210
118
    return OS << "SubExpression";
211
210
  case syntax::NodeRole::Object:
212
210
    return OS << "Object";
213
210
  case syntax::NodeRole::AccessToken:
214
210
    return OS << "AccessToken";
215
210
  case syntax::NodeRole::Member:
216
210
    return OS << "Member";
217
423
  case syntax::NodeRole::Callee:
218
423
    return OS << "Callee";
219
102
  case syntax::NodeRole::Arguments:
220
102
    return OS << "Arguments";
221
0
  }
222
0
  llvm_unreachable("invalid role");
223
0
}
224
225
// We could have an interator in list to not pay memory costs of temporary
226
// vector
227
std::vector<syntax::NameSpecifier *>
228
0
syntax::NestedNameSpecifier::getSpecifiers() {
229
0
  auto SpecifiersAsNodes = getElementsAsNodes();
230
0
  std::vector<syntax::NameSpecifier *> Children;
231
0
  for (const auto &Element : SpecifiersAsNodes) {
232
0
    Children.push_back(llvm::cast<syntax::NameSpecifier>(Element));
233
0
  }
234
0
  return Children;
235
0
}
236
237
std::vector<syntax::List::ElementAndDelimiter<syntax::NameSpecifier>>
238
0
syntax::NestedNameSpecifier::getSpecifiersAndDoubleColons() {
239
0
  auto SpecifiersAsNodesAndDoubleColons = getElementsAsNodesAndDelimiters();
240
0
  std::vector<syntax::List::ElementAndDelimiter<syntax::NameSpecifier>>
241
0
      Children;
242
0
  for (const auto &SpecifierAndDoubleColon : SpecifiersAsNodesAndDoubleColons) {
243
0
    Children.push_back(
244
0
        {llvm::cast<syntax::NameSpecifier>(SpecifierAndDoubleColon.element),
245
0
         SpecifierAndDoubleColon.delimiter});
246
0
  }
247
0
  return Children;
248
0
}
249
250
0
std::vector<syntax::Expression *> syntax::CallArguments::getArguments() {
251
0
  auto ArgumentsAsNodes = getElementsAsNodes();
252
0
  std::vector<syntax::Expression *> Children;
253
0
  for (const auto &ArgumentAsNode : ArgumentsAsNodes) {
254
0
    Children.push_back(llvm::cast<syntax::Expression>(ArgumentAsNode));
255
0
  }
256
0
  return Children;
257
0
}
258
259
std::vector<syntax::List::ElementAndDelimiter<syntax::Expression>>
260
0
syntax::CallArguments::getArgumentsAndCommas() {
261
0
  auto ArgumentsAsNodesAndCommas = getElementsAsNodesAndDelimiters();
262
0
  std::vector<syntax::List::ElementAndDelimiter<syntax::Expression>> Children;
263
0
  for (const auto &ArgumentAsNodeAndComma : ArgumentsAsNodesAndCommas) {
264
0
    Children.push_back(
265
0
        {llvm::cast<syntax::Expression>(ArgumentAsNodeAndComma.element),
266
0
         ArgumentAsNodeAndComma.delimiter});
267
0
  }
268
0
  return Children;
269
0
}
270
271
std::vector<syntax::SimpleDeclaration *>
272
0
syntax::ParameterDeclarationList::getParameterDeclarations() {
273
0
  auto ParametersAsNodes = getElementsAsNodes();
274
0
  std::vector<syntax::SimpleDeclaration *> Children;
275
0
  for (const auto &ParameterAsNode : ParametersAsNodes) {
276
0
    Children.push_back(llvm::cast<syntax::SimpleDeclaration>(ParameterAsNode));
277
0
  }
278
0
  return Children;
279
0
}
280
281
std::vector<syntax::List::ElementAndDelimiter<syntax::SimpleDeclaration>>
282
0
syntax::ParameterDeclarationList::getParametersAndCommas() {
283
0
  auto ParametersAsNodesAndCommas = getElementsAsNodesAndDelimiters();
284
0
  std::vector<syntax::List::ElementAndDelimiter<syntax::SimpleDeclaration>>
285
0
      Children;
286
0
  for (const auto &ParameterAsNodeAndComma : ParametersAsNodesAndCommas) {
287
0
    Children.push_back(
288
0
        {llvm::cast<syntax::SimpleDeclaration>(ParameterAsNodeAndComma.element),
289
0
         ParameterAsNodeAndComma.delimiter});
290
0
  }
291
0
  return Children;
292
0
}
293
294
0
syntax::Expression *syntax::MemberExpression::getObject() {
295
0
  return cast_or_null<syntax::Expression>(findChild(syntax::NodeRole::Object));
296
0
}
297
298
0
syntax::Leaf *syntax::MemberExpression::getTemplateKeyword() {
299
0
  return llvm::cast_or_null<syntax::Leaf>(
300
0
      findChild(syntax::NodeRole::TemplateKeyword));
301
0
}
302
303
0
syntax::Leaf *syntax::MemberExpression::getAccessToken() {
304
0
  return llvm::cast_or_null<syntax::Leaf>(
305
0
      findChild(syntax::NodeRole::AccessToken));
306
0
}
307
308
0
syntax::IdExpression *syntax::MemberExpression::getMember() {
309
0
  return cast_or_null<syntax::IdExpression>(
310
0
      findChild(syntax::NodeRole::Member));
311
0
}
312
313
0
syntax::NestedNameSpecifier *syntax::IdExpression::getQualifier() {
314
0
  return cast_or_null<syntax::NestedNameSpecifier>(
315
0
      findChild(syntax::NodeRole::Qualifier));
316
0
}
317
318
0
syntax::Leaf *syntax::IdExpression::getTemplateKeyword() {
319
0
  return llvm::cast_or_null<syntax::Leaf>(
320
0
      findChild(syntax::NodeRole::TemplateKeyword));
321
0
}
322
323
0
syntax::UnqualifiedId *syntax::IdExpression::getUnqualifiedId() {
324
0
  return cast_or_null<syntax::UnqualifiedId>(
325
0
      findChild(syntax::NodeRole::UnqualifiedId));
326
0
}
327
328
0
syntax::Leaf *syntax::ParenExpression::getOpenParen() {
329
0
  return cast_or_null<syntax::Leaf>(findChild(syntax::NodeRole::OpenParen));
330
0
}
331
332
0
syntax::Expression *syntax::ParenExpression::getSubExpression() {
333
0
  return cast_or_null<syntax::Expression>(
334
0
      findChild(syntax::NodeRole::SubExpression));
335
0
}
336
337
0
syntax::Leaf *syntax::ParenExpression::getCloseParen() {
338
0
  return cast_or_null<syntax::Leaf>(findChild(syntax::NodeRole::CloseParen));
339
0
}
340
341
0
syntax::Leaf *syntax::ThisExpression::getThisKeyword() {
342
0
  return cast_or_null<syntax::Leaf>(
343
0
      findChild(syntax::NodeRole::IntroducerKeyword));
344
0
}
345
346
0
syntax::Leaf *syntax::LiteralExpression::getLiteralToken() {
347
0
  return cast_or_null<syntax::Leaf>(findChild(syntax::NodeRole::LiteralToken));
348
0
}
349
350
0
syntax::Expression *syntax::BinaryOperatorExpression::getLhs() {
351
0
  return cast_or_null<syntax::Expression>(
352
0
      findChild(syntax::NodeRole::LeftHandSide));
353
0
}
354
355
0
syntax::Leaf *syntax::UnaryOperatorExpression::getOperatorToken() {
356
0
  return cast_or_null<syntax::Leaf>(findChild(syntax::NodeRole::OperatorToken));
357
0
}
358
359
0
syntax::Expression *syntax::UnaryOperatorExpression::getOperand() {
360
0
  return cast_or_null<syntax::Expression>(findChild(syntax::NodeRole::Operand));
361
0
}
362
363
0
syntax::Leaf *syntax::BinaryOperatorExpression::getOperatorToken() {
364
0
  return cast_or_null<syntax::Leaf>(findChild(syntax::NodeRole::OperatorToken));
365
0
}
366
367
0
syntax::Expression *syntax::BinaryOperatorExpression::getRhs() {
368
0
  return cast_or_null<syntax::Expression>(
369
0
      findChild(syntax::NodeRole::RightHandSide));
370
0
}
371
372
0
syntax::Expression *syntax::CallExpression::getCallee() {
373
0
  return cast_or_null<syntax::Expression>(findChild(syntax::NodeRole::Callee));
374
0
}
375
376
0
syntax::Leaf *syntax::CallExpression::getOpenParen() {
377
0
  return cast_or_null<syntax::Leaf>(findChild(syntax::NodeRole::OpenParen));
378
0
}
379
380
0
syntax::CallArguments *syntax::CallExpression::getArguments() {
381
0
  return cast_or_null<syntax::CallArguments>(
382
0
      findChild(syntax::NodeRole::Arguments));
383
0
}
384
385
0
syntax::Leaf *syntax::CallExpression::getCloseParen() {
386
0
  return cast_or_null<syntax::Leaf>(findChild(syntax::NodeRole::CloseParen));
387
0
}
388
389
0
syntax::Leaf *syntax::SwitchStatement::getSwitchKeyword() {
390
0
  return cast_or_null<syntax::Leaf>(
391
0
      findChild(syntax::NodeRole::IntroducerKeyword));
392
0
}
393
394
0
syntax::Statement *syntax::SwitchStatement::getBody() {
395
0
  return cast_or_null<syntax::Statement>(
396
0
      findChild(syntax::NodeRole::BodyStatement));
397
0
}
398
399
0
syntax::Leaf *syntax::CaseStatement::getCaseKeyword() {
400
0
  return cast_or_null<syntax::Leaf>(
401
0
      findChild(syntax::NodeRole::IntroducerKeyword));
402
0
}
403
404
0
syntax::Expression *syntax::CaseStatement::getCaseValue() {
405
0
  return cast_or_null<syntax::Expression>(
406
0
      findChild(syntax::NodeRole::CaseValue));
407
0
}
408
409
0
syntax::Statement *syntax::CaseStatement::getBody() {
410
0
  return cast_or_null<syntax::Statement>(
411
0
      findChild(syntax::NodeRole::BodyStatement));
412
0
}
413
414
0
syntax::Leaf *syntax::DefaultStatement::getDefaultKeyword() {
415
0
  return cast_or_null<syntax::Leaf>(
416
0
      findChild(syntax::NodeRole::IntroducerKeyword));
417
0
}
418
419
0
syntax::Statement *syntax::DefaultStatement::getBody() {
420
0
  return cast_or_null<syntax::Statement>(
421
0
      findChild(syntax::NodeRole::BodyStatement));
422
0
}
423
424
0
syntax::Leaf *syntax::IfStatement::getIfKeyword() {
425
0
  return cast_or_null<syntax::Leaf>(
426
0
      findChild(syntax::NodeRole::IntroducerKeyword));
427
0
}
428
429
0
syntax::Statement *syntax::IfStatement::getThenStatement() {
430
0
  return cast_or_null<syntax::Statement>(
431
0
      findChild(syntax::NodeRole::ThenStatement));
432
0
}
433
434
0
syntax::Leaf *syntax::IfStatement::getElseKeyword() {
435
0
  return cast_or_null<syntax::Leaf>(findChild(syntax::NodeRole::ElseKeyword));
436
0
}
437
438
0
syntax::Statement *syntax::IfStatement::getElseStatement() {
439
0
  return cast_or_null<syntax::Statement>(
440
0
      findChild(syntax::NodeRole::ElseStatement));
441
0
}
442
443
0
syntax::Leaf *syntax::ForStatement::getForKeyword() {
444
0
  return cast_or_null<syntax::Leaf>(
445
0
      findChild(syntax::NodeRole::IntroducerKeyword));
446
0
}
447
448
0
syntax::Statement *syntax::ForStatement::getBody() {
449
0
  return cast_or_null<syntax::Statement>(
450
0
      findChild(syntax::NodeRole::BodyStatement));
451
0
}
452
453
0
syntax::Leaf *syntax::WhileStatement::getWhileKeyword() {
454
0
  return cast_or_null<syntax::Leaf>(
455
0
      findChild(syntax::NodeRole::IntroducerKeyword));
456
0
}
457
458
0
syntax::Statement *syntax::WhileStatement::getBody() {
459
0
  return cast_or_null<syntax::Statement>(
460
0
      findChild(syntax::NodeRole::BodyStatement));
461
0
}
462
463
0
syntax::Leaf *syntax::ContinueStatement::getContinueKeyword() {
464
0
  return cast_or_null<syntax::Leaf>(
465
0
      findChild(syntax::NodeRole::IntroducerKeyword));
466
0
}
467
468
0
syntax::Leaf *syntax::BreakStatement::getBreakKeyword() {
469
0
  return cast_or_null<syntax::Leaf>(
470
0
      findChild(syntax::NodeRole::IntroducerKeyword));
471
0
}
472
473
0
syntax::Leaf *syntax::ReturnStatement::getReturnKeyword() {
474
0
  return cast_or_null<syntax::Leaf>(
475
0
      findChild(syntax::NodeRole::IntroducerKeyword));
476
0
}
477
478
0
syntax::Expression *syntax::ReturnStatement::getReturnValue() {
479
0
  return cast_or_null<syntax::Expression>(
480
0
      findChild(syntax::NodeRole::ReturnValue));
481
0
}
482
483
0
syntax::Leaf *syntax::RangeBasedForStatement::getForKeyword() {
484
0
  return cast_or_null<syntax::Leaf>(
485
0
      findChild(syntax::NodeRole::IntroducerKeyword));
486
0
}
487
488
0
syntax::Statement *syntax::RangeBasedForStatement::getBody() {
489
0
  return cast_or_null<syntax::Statement>(
490
0
      findChild(syntax::NodeRole::BodyStatement));
491
0
}
492
493
0
syntax::Expression *syntax::ExpressionStatement::getExpression() {
494
0
  return cast_or_null<syntax::Expression>(
495
0
      findChild(syntax::NodeRole::Expression));
496
0
}
497
498
0
syntax::Leaf *syntax::CompoundStatement::getLbrace() {
499
0
  return cast_or_null<syntax::Leaf>(findChild(syntax::NodeRole::OpenParen));
500
0
}
501
502
0
std::vector<syntax::Statement *> syntax::CompoundStatement::getStatements() {
503
0
  std::vector<syntax::Statement *> Children;
504
0
  for (auto *C = getFirstChild(); C; C = C->getNextSibling()) {
505
0
    assert(C->getRole() == syntax::NodeRole::Statement);
506
0
    Children.push_back(cast<syntax::Statement>(C));
507
0
  }
508
0
  return Children;
509
0
}
510
511
0
syntax::Leaf *syntax::CompoundStatement::getRbrace() {
512
0
  return cast_or_null<syntax::Leaf>(findChild(syntax::NodeRole::CloseParen));
513
0
}
514
515
0
syntax::Expression *syntax::StaticAssertDeclaration::getCondition() {
516
0
  return cast_or_null<syntax::Expression>(
517
0
      findChild(syntax::NodeRole::Condition));
518
0
}
519
520
0
syntax::Expression *syntax::StaticAssertDeclaration::getMessage() {
521
0
  return cast_or_null<syntax::Expression>(findChild(syntax::NodeRole::Message));
522
0
}
523
524
std::vector<syntax::SimpleDeclarator *>
525
0
syntax::SimpleDeclaration::getDeclarators() {
526
0
  std::vector<syntax::SimpleDeclarator *> Children;
527
0
  for (auto *C = getFirstChild(); C; C = C->getNextSibling()) {
528
0
    if (C->getRole() == syntax::NodeRole::Declarator)
529
0
      Children.push_back(cast<syntax::SimpleDeclarator>(C));
530
0
  }
531
0
  return Children;
532
0
}
533
534
0
syntax::Leaf *syntax::TemplateDeclaration::getTemplateKeyword() {
535
0
  return cast_or_null<syntax::Leaf>(
536
0
      findChild(syntax::NodeRole::IntroducerKeyword));
537
0
}
538
539
0
syntax::Declaration *syntax::TemplateDeclaration::getDeclaration() {
540
0
  return cast_or_null<syntax::Declaration>(
541
0
      findChild(syntax::NodeRole::Declaration));
542
0
}
543
544
0
syntax::Leaf *syntax::ExplicitTemplateInstantiation::getTemplateKeyword() {
545
0
  return cast_or_null<syntax::Leaf>(
546
0
      findChild(syntax::NodeRole::IntroducerKeyword));
547
0
}
548
549
0
syntax::Leaf *syntax::ExplicitTemplateInstantiation::getExternKeyword() {
550
0
  return cast_or_null<syntax::Leaf>(findChild(syntax::NodeRole::ExternKeyword));
551
0
}
552
553
0
syntax::Declaration *syntax::ExplicitTemplateInstantiation::getDeclaration() {
554
0
  return cast_or_null<syntax::Declaration>(
555
0
      findChild(syntax::NodeRole::Declaration));
556
0
}
557
558
0
syntax::Leaf *syntax::ParenDeclarator::getLparen() {
559
0
  return cast_or_null<syntax::Leaf>(findChild(syntax::NodeRole::OpenParen));
560
0
}
561
562
0
syntax::Leaf *syntax::ParenDeclarator::getRparen() {
563
0
  return cast_or_null<syntax::Leaf>(findChild(syntax::NodeRole::CloseParen));
564
0
}
565
566
0
syntax::Leaf *syntax::ArraySubscript::getLbracket() {
567
0
  return cast_or_null<syntax::Leaf>(findChild(syntax::NodeRole::OpenParen));
568
0
}
569
570
0
syntax::Expression *syntax::ArraySubscript::getSize() {
571
0
  return cast_or_null<syntax::Expression>(findChild(syntax::NodeRole::Size));
572
0
}
573
574
0
syntax::Leaf *syntax::ArraySubscript::getRbracket() {
575
0
  return cast_or_null<syntax::Leaf>(findChild(syntax::NodeRole::CloseParen));
576
0
}
577
578
0
syntax::Leaf *syntax::TrailingReturnType::getArrowToken() {
579
0
  return cast_or_null<syntax::Leaf>(findChild(syntax::NodeRole::ArrowToken));
580
0
}
581
582
0
syntax::SimpleDeclarator *syntax::TrailingReturnType::getDeclarator() {
583
0
  return cast_or_null<syntax::SimpleDeclarator>(
584
0
      findChild(syntax::NodeRole::Declarator));
585
0
}
586
587
0
syntax::Leaf *syntax::ParametersAndQualifiers::getLparen() {
588
0
  return cast_or_null<syntax::Leaf>(findChild(syntax::NodeRole::OpenParen));
589
0
}
590
591
syntax::ParameterDeclarationList *
592
0
syntax::ParametersAndQualifiers::getParameters() {
593
0
  return cast_or_null<syntax::ParameterDeclarationList>(
594
0
      findChild(syntax::NodeRole::Parameters));
595
0
}
596
597
0
syntax::Leaf *syntax::ParametersAndQualifiers::getRparen() {
598
0
  return cast_or_null<syntax::Leaf>(findChild(syntax::NodeRole::CloseParen));
599
0
}
600
601
syntax::TrailingReturnType *
602
0
syntax::ParametersAndQualifiers::getTrailingReturn() {
603
0
  return cast_or_null<syntax::TrailingReturnType>(
604
0
      findChild(syntax::NodeRole::TrailingReturn));
605
0
}