enum class NodeRole

Description

A relation between a parent and child node, e.g. 'left-hand-side of a binary expression'. Used for implementing accessors. In general `NodeRole`s should be named the same as their accessors. Some roles describe parent/child relations that occur multiple times in language grammar. We define only one role to describe all instances of such recurring relations. For example, grammar for both "if" and "while" statements requires an opening paren and a closing paren. The opening paren token is assigned the OpenParen role regardless of whether it appears as a child of IfStatement or WhileStatement node. More generally, when grammar requires a certain fixed token (like a specific keyword, or an opening paren), we define a role for this token and use it across all grammar rules with the same requirement. Names of such reusable roles end with a ~Token or a ~Keyword suffix.

Declared at: clang/include/clang/Tooling/Syntax/Nodes.h:54

Enumerators

NameValueComment
Detached0A node without a parent
Unknown1Children of an unknown semantic nature, e.g. skipped tokens, comments.
OpenParen2An opening parenthesis in argument lists and blocks, e.g. '{', '(', etc.
CloseParen3A closing parenthesis in argument lists and blocks, e.g. '}', ')', etc.
IntroducerKeyword4A keywords that introduces some grammar construct, e.g. 'if', 'try', etc.
LiteralToken5A token that represents a literal, e.g. 'nullptr', '1', 'true', etc.
ArrowToken6Tokens or Keywords.
ExternKeyword7Tokens or Keywords.
TemplateKeyword8Tokens or Keywords.
BodyStatement9An inner statement for those that have only a single child of kind statement, e.g. loop body for while, for, etc; inner statement for case, default, etc.
ListElement10List API roles.
ListDelimiter11List API roles.
OperatorToken12List API roles.
Operand13List API roles.
LeftHandSide14List API roles.
RightHandSide15List API roles.
ReturnValue16List API roles.
CaseValue17List API roles.
ThenStatement18List API roles.
ElseKeyword19List API roles.
ElseStatement20List API roles.
Expression21List API roles.
Statement22List API roles.
Condition23List API roles.
Message24List API roles.
Declarator25List API roles.
Declaration26List API roles.
Size27List API roles.
Parameters28List API roles.
TrailingReturn29List API roles.
UnqualifiedId30List API roles.
Qualifier31List API roles.
SubExpression32List API roles.
Object33List API roles.
AccessToken34List API roles.
Member35List API roles.
Callee36List API roles.
Arguments37List API roles.
Declarators38List API roles.