clang: include/clang/Tooling/Syntax/Nodes.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21#ifndef LLVM_CLANG_TOOLING_SYNTAX_NODES_H

22#define LLVM_CLANG_TOOLING_SYNTAX_NODES_H

23

27namespace syntax {

28

29

30

31

33#define CONCRETE_NODE(Kind, Base) Kind,

34#include "clang/Tooling/Syntax/Nodes.inc"

35};

36

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

55

56

58

60

62

64

66

68

72

73

74

76

79

80

108};

109

111

112#include "clang/Tooling/Syntax/NodeClasses.inc"

113

114

115

117public:

121 std::vector<List::ElementAndDelimitersyntax::NameSpecifier>

123};

124

125

126

128public:

131};

132

133

134

136public:

139};

140

141

142

143

144

145

147public:

152};

153

154

156public:

161};

162

163

164

165

166

167

168

169

170

171

173public:

177};

178

179

180

181

182

183

185public:

189};

190

191

192

193

194

195

196

197

199public:

205};

206

207

208

210public:

213};

214

215

216

218public:

221};

222

223

225public:

228};

229

230

232public:

235};

236

237

239public:

244};

245

246

248public:

254};

255

256

258public:

263};

264

265

266

268public:

275};

276

277

279public:

284};

285

286

288public:

293};

294

295

297public:

301};

302

303

305public:

309};

310

311

312

314public:

319};

320

321

323public:

328};

329

330

331

333public:

337};

338

339

341public:

345

348};

349

350

351

352

353

355public:

358};

359

360

362public:

365};

366

367

369public:

372};

373

374

375

377public:

382};

383

384

385

387public:

391};

392

394public:

398 std::vector<List::ElementAndDelimitersyntax::SimpleDeclarator>

400};

401

402

403

404

406public:

409

411};

412

413

415public:

420};

421

422

423

424

425

426

428public:

435};

436

437

439public:

442};

443

444

446public:

450};

451

452

454public:

457};

458

459

460

462public:

465};

466

467

469public:

472};

473

474

475

476

477

478

479

480

481

482

483

484

485

487public:

490};

491

492

493

495public:

498};

499

500

501

502

504public:

509};

510

511

512

513

514

516public:

519

523};

524

525

526

528public:

531

533

534

536};

537

538

539

541public:

545 std::vector<List::ElementAndDelimitersyntax::SimpleDeclaration>

547};

548

549

550

551

552

553

554

555

556

557

558

559

561public:

568};

569

570

571

573public:

576};

577

578#define CONCRETE_NODE(Kind, Base) \

579 inline bool Kind::classof(const Node *N) { \

580 return N->getKind() == NodeKind::Kind; \

581 }

582#define ABSTRACT_NODE(Kind, Base, First, Last) \

583 inline bool Kind::classof(const Node *N) { \

584 return N->getKind() >= NodeKind::First && N->getKind() <= NodeKind::Last; \

585 }

586#include "clang/Tooling/Syntax/Nodes.inc"

587

588}

589}

590#endif

Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.

Array size specified inside a declarator.

static bool classof(const Node *N)

BinaryOperatorExpression()

Leaf * getOperatorToken()

static bool classof(const Node *N)

static bool classof(const Node *N)

Models arguments of a function call.

static bool classof(const Node *N)

std::vector< List::ElementAndDelimiter< Expression > > getArgumentsAndCommas()

std::vector< Expression * > getArguments()

Expression * getCaseValue()

static bool classof(const Node *N)

{ statement1; statement2; … }

static bool classof(const Node *N)

std::vector< Statement * > getStatements()

FIXME: use custom iterator instead of 'vector'.

static bool classof(const Node *N)

Leaf * getContinueKeyword()

static bool classof(const Node *N)

A declaration that can appear at the top-level.

static bool classof(const Node *N)

static bool classof(const Node *N)

std::vector< SimpleDeclarator * > getDeclarators()

std::vector< List::ElementAndDelimiter< syntax::SimpleDeclarator > > getDeclaratorsAndCommas()

Covers a name, an initializer and a part of the type outside declaration specifiers.

static bool classof(const Node *N)

Leaf * getDefaultKeyword()

static bool classof(const Node *N)

A semicolon in the top-level context. Does not declare anything.

static bool classof(const Node *N)

The no-op statement, i.e. ';'.

static bool classof(const Node *N)

template Examples: template struct X template void foo() template int var<dou...

Leaf * getExternKeyword()

ExplicitTemplateInstantiation()

static bool classof(const Node *N)

Leaf * getTemplateKeyword()

Declaration * getDeclaration()

Expression in a statement position, e.g.

static bool classof(const Node *N)

Expression * getExpression()

for (; ; )

static bool classof(const Node *N)

if (cond) else FIXME: add condition that models 'expression or vari...

static bool classof(const Node *N)

Statement * getThenStatement()

Statement * getElseStatement()

A leaf node points to a single token.

extern declaration extern { }

LinkageSpecificationDeclaration()

static bool classof(const Node *N)

A list of Elements separated or terminated by a fixed token.

Member pointer inside a declarator E.g.

static bool classof(const Node *N)

namespace =

static bool classof(const Node *N)

NamespaceAliasDefinition()

namespace { }

static bool classof(const Node *N)

Models a nested-name-specifier.

std::vector< NameSpecifier * > getSpecifiers()

std::vector< List::ElementAndDelimiter< syntax::NameSpecifier > > getSpecifiersAndDoubleColons()

static bool classof(const Node *N)

Models a parameter-declaration-list which appears within parameters-and-qualifiers.

std::vector< List::ElementAndDelimiter< syntax::SimpleDeclaration > > getParametersAndCommas()

static bool classof(const Node *N)

ParameterDeclarationList()

std::vector< SimpleDeclaration * > getParameterDeclarations()

Parameter list for a function type and a trailing return type, if the function has one.

ParameterDeclarationList * getParameters()

ParametersAndQualifiers()

TrailingReturnType * getTrailingReturn()

static bool classof(const Node *N)

Declarator inside parentheses.

static bool classof(const Node *N)

static bool classof(const Node *N)

PostfixUnaryOperatorExpression()

static bool classof(const Node *N)

PrefixUnaryOperatorExpression()

for ( : )

static bool classof(const Node *N)

Leaf * getReturnKeyword()

static bool classof(const Node *N)

Expression * getReturnValue()

Groups multiple declarators (e.g.

std::vector< SimpleDeclarator * > getDeclarators()

FIXME: use custom iterator instead of 'vector'.

static bool classof(const Node *N)

A top-level declarator without parentheses.

static bool classof(const Node *N)

An abstract node for C++ statements, e.g.

static bool classof(const Node *N)

static_assert(, ) static_assert()

Expression * getMessage()

Expression * getCondition()

StaticAssertDeclaration()

static bool classof(const Node *N)

static bool classof(const Node *N)

Leaf * getSwitchKeyword()

template

Leaf * getTemplateKeyword()

Declaration * getDeclaration()

static bool classof(const Node *N)

Trailing return type after the parameter list, including the arrow token.

SimpleDeclarator * getDeclarator()

static bool classof(const Node *N)

A node that has children and represents a syntactic language construct.

static bool classof(const Node *N)

An abstract class for prefix and postfix unary operators.

static bool classof(const Node *N)

Expression * getOperand()

UnaryOperatorExpression(NodeKind K)

Leaf * getOperatorToken()

Declaration of an unknown kind, e.g. not yet supported in syntax trees.

static bool classof(const Node *N)

An expression of an unknown kind, i.e.

static bool classof(const Node *N)

A statement of an unknown kind, i.e.

static bool classof(const Node *N)

Models an unqualified-id.

static bool classof(const Node *N)

using :: using typename ::

static bool classof(const Node *N)

UsingNamespaceDirective()

static bool classof(const Node *N)

static bool classof(const Node *N)

NodeRole

A relation between a parent and child node, e.g.

@ ListElement

List API roles.

@ LiteralToken

A token that represents a literal, e.g. 'nullptr', '1', 'true', etc.

@ Detached

A node without a parent.

@ CloseParen

A closing parenthesis in argument lists and blocks, e.g. '}', ')', etc.

@ IntroducerKeyword

A keywords that introduces some grammar construct, e.g. 'if', 'try', etc.

@ Unknown

Children of an unknown semantic nature, e.g. skipped tokens, comments.

@ BodyStatement

An inner statement for those that have only a single child of kind statement, e.g.

@ OpenParen

An opening parenthesis in argument lists and blocks, e.g. '{', '(', etc.

@ ArrowToken

Tokens or Keywords.

NodeKind

A kind of a syntax node, used for implementing casts.

raw_ostream & operator<<(raw_ostream &OS, NodeKind K)

For debugging purposes.

The JSON file list parser is used to communicate input to InstallAPI.