Go to the documentation of this file.
21 #ifndef LLVM_CLANG_TOOLING_SYNTAX_NODES_H
22 #define LLVM_CLANG_TOOLING_SYNTAX_NODES_H
33 #define CONCRETE_NODE(Kind, Base) Kind,
34 #include "clang/Tooling/Syntax/Nodes.inc"
112 #include "clang/Tooling/Syntax/NodeClasses.inc"
121 std::vector<List::ElementAndDelimiter<syntax::NameSpecifier>>
398 std::vector<List::ElementAndDelimiter<syntax::SimpleDeclarator>>
545 std::vector<List::ElementAndDelimiter<syntax::SimpleDeclaration>>
578 #define CONCRETE_NODE(Kind, Base) \
579 inline bool Kind::classof(const Node *N) { \
580 return N->getKind() == NodeKind::Kind; \
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; \
586 #include "clang/Tooling/Syntax/Nodes.inc"
template <template-parameters> <declaration>
static bool classof(const Node *N)
for (<init>; <cond>; <increment>) <body>
Leaf * getReturnKeyword()
static bool classof(const Node *N)
std::vector< SimpleDeclaration * > getParameterDeclarations()
ParameterDeclarationList()
Leaf * getTemplateKeyword()
static bool classof(const Node *N)
static bool classof(const Node *N)
static bool classof(const Node *N)
namespace <name> { <decls> }
static bool classof(const Node *N)
for (<decl> : <init>) <body>
raw_ostream & operator<<(raw_ostream &OS, NodeKind K)
For debugging purposes.
An expression of an unknown kind, i.e.
static bool classof(const Node *N)
Declarator inside parentheses.
@ Detached
A node without a parent.
namespace <name> = <namespace-reference>
Expression * getReturnValue()
@ CloseParen
A closing parenthesis in argument lists and blocks, e.g. '}', ')', etc.
std::vector< List::ElementAndDelimiter< syntax::SimpleDeclaration > > getParametersAndCommas()
static bool classof(const Node *N)
std::vector< List::ElementAndDelimiter< syntax::NameSpecifier > > getSpecifiersAndDoubleColons()
Statement * getThenStatement()
Models an unqualified-id.
NamespaceAliasDefinition()
BinaryOperatorExpression()
PostfixUnaryOperatorExpression()
Expression * getCaseValue()
SimpleDeclarator * getDeclarator()
static_assert(<condition>, <message>) static_assert(<condition>)
A list of Elements separated or terminated by a fixed token.
@ ArrowToken
Tokens or Keywords.
static bool classof(const Node *N)
static bool classof(const Node *N)
static bool classof(const Node *N)
static bool classof(const Node *N)
A node that has children and represents a syntactic language construct.
Declaration * getDeclaration()
Array size specified inside a declarator.
static bool classof(const Node *N)
static bool classof(const Node *N)
std::vector< Statement * > getStatements()
FIXME: use custom iterator instead of 'vector'.
ExplicitTemplateInstantiation()
static bool classof(const Node *N)
TrailingReturnType * getTrailingReturn()
static bool classof(const Node *N)
Statement * getElseStatement()
static bool classof(const Node *N)
Leaf * getOperatorToken()
ParametersAndQualifiers()
@ ListElement
List API roles.
static bool classof(const Node *N)
static bool classof(const Node *N)
Groups multiple declarators (e.g.
Leaf * getOperatorToken()
@ Unknown
Children of an unknown semantic nature, e.g. skipped tokens, comments.
static bool classof(const Node *N)
std::vector< SimpleDeclarator * > getDeclarators()
static bool classof(const Node *N)
static bool classof(const Node *N)
static bool classof(const Node *N)
Expression * getExpression()
Expression * getOperand()
The no-op statement, i.e. ';'.
static bool classof(const Node *N)
std::vector< Expression * > getArguments()
Expression in a statement position, e.g.
static bool classof(const Node *N)
if (cond) <then-statement> else <else-statement> FIXME: add condition that models 'expression or vari...
static bool classof(const Node *N)
static bool classof(const Node *N)
static bool classof(const Node *N)
ParameterDeclarationList * getParameters()
static bool classof(const Node *N)
static bool classof(const Node *N)
static bool classof(const Node *N)
Models arguments of a function call.
static bool classof(const Node *N)
Expression * getCondition()
std::vector< SimpleDeclarator * > getDeclarators()
FIXME: use custom iterator instead of 'vector'.
static bool classof(const Node *N)
static bool classof(const Node *N)
@ OpenParen
An opening parenthesis in argument lists and blocks, e.g. '{', '(', etc.
UnaryOperatorExpression(NodeKind K)
Covers a name, an initializer and a part of the type outside declaration specifiers.
LinkageSpecificationDeclaration()
extern <string-literal> declaration extern <string-literal> { <decls> }
std::vector< List::ElementAndDelimiter< Expression > > getArgumentsAndCommas()
static bool classof(const Node *N)
Declaration * getDeclaration()
A top-level declarator without parentheses.
static bool classof(const Node *N)
A leaf node points to a single token.
An abstract class for prefix and postfix unary operators.
static bool classof(const Node *N)
Member pointer inside a declarator E.g.
static bool classof(const Node *N)
NodeRole
A relation between a parent and child node, e.g.
Leaf * getContinueKeyword()
NodeKind
A kind of a syntax node, used for implementing casts.
StaticAssertDeclaration()
Leaf * getExternKeyword()
@ IntroducerKeyword
A keywords that introduces some grammar construct, e.g. 'if', 'try', etc.
template <declaration> Examples: template struct X<int> template void foo<int>() template int var<dou...
static bool classof(const Node *N)
static bool classof(const Node *N)
@ BodyStatement
An inner statement for those that have only a single child of kind statement, e.g.
UsingNamespaceDirective()
Trailing return type after the parameter list, including the arrow token.
@ LiteralToken
A token that represents a literal, e.g. 'nullptr', '1', 'true', etc.
static bool classof(const Node *N)
std::vector< List::ElementAndDelimiter< syntax::SimpleDeclarator > > getDeclaratorsAndCommas()
Leaf * getTemplateKeyword()
std::vector< NameSpecifier * > getSpecifiers()
static bool classof(const Node *N)
static bool classof(const Node *N)
Declaration of an unknown kind, e.g. not yet supported in syntax trees.
A declaration that can appear at the top-level.
static bool classof(const Node *N)
A semicolon in the top-level context. Does not declare anything.
Parameter list for a function type and a trailing return type, if the function has one.
Leaf * getSwitchKeyword()
PrefixUnaryOperatorExpression()
Models a parameter-declaration-list which appears within parameters-and-qualifiers.
Expression * getMessage()
An abstract node for C++ statements, e.g.
using <scope>::<name> using typename <scope>::<name>
Leaf * getDefaultKeyword()
static bool classof(const Node *N)
A statement of an unknown kind, i.e.
{ statement1; statement2; … }
static bool classof(const Node *N)
Models a nested-name-specifier.