class List
Declaration
class List : public Tree { /* full declaration omitted */ };
Description
A list of Elements separated or terminated by a fixed token. This type models the following grammar construct: delimited-list(element, delimiter, termination, canBeEmpty)
Declared at: clang/include/clang/Tooling/Syntax/Tree.h:254
Inherits from: Tree
Member Variables
Method Overview
- public bool canBeEmpty() const
- public static bool classof(const clang::syntax::Node * N)
- public clang::tok::TokenKind getDelimiterTokenKind() const
- public std::vector<Node *> getElementsAsNodes()
- public std::vector<ElementAndDelimiter<Node>> getElementsAsNodesAndDelimiters()
- public clang::syntax::List::TerminationKind getTerminationKind() const
Inherited from Tree:
- public classof
- public findChild
- public findChild
- public findFirstLeaf
- public findFirstLeaf
- public findLastLeaf
- public findLastLeaf
- public getChildren
- public getChildren
- public getFirstChild
- public getFirstChild
- public getLastChild
- public getLastChild
Inherited from Node:
- public assertInvariants
- public assertInvariantsRecursive
- public canModify
- public dump
- public dumpTokens
- public getKind
- public getNextSibling
- public getNextSibling
- public getParent
- public getParent
- public getPreviousSibling
- public getPreviousSibling
- public getRole
- public isDetached
- public isOriginal
Methods
¶bool canBeEmpty() const
bool canBeEmpty() const
Description
Whether this list can be empty in syntactically and semantically correct code. This list may be empty when the source code has errors even if canBeEmpty() returns false.
Declared at: clang/include/clang/Tooling/Syntax/Tree.h:305
¶static bool classof(const clang::syntax::Node* N)
static bool classof(const clang::syntax::Node* N)
Declared at: clang/include/clang/Tooling/Syntax/Tree.h:268
Parameters
- const clang::syntax::Node* N
¶clang::tok::TokenKind getDelimiterTokenKind()
const
clang::tok::TokenKind getDelimiterTokenKind()
const
Description
Returns the appropriate delimiter for this list. Useful for discovering the correct delimiter to use when adding elements to empty or one-element lists.
Declared at: clang/include/clang/Tooling/Syntax/Tree.h:296
¶std::vector<Node*> getElementsAsNodes()
std::vector<Node*> getElementsAsNodes()
Description
Returns the elements of the list. Missing elements are represented as null pointers in the same way as in the return value of `getElementsAsNodesAndDelimiters()`.
Declared at: clang/include/clang/Tooling/Syntax/Tree.h:288
¶std::vector<ElementAndDelimiter<Node>>
getElementsAsNodesAndDelimiters()
std::vector<ElementAndDelimiter<Node>>
getElementsAsNodesAndDelimiters()
Description
Returns the elements and corresponding delimiters. Missing elements and delimiters are represented as null pointers. For example, in a separated list: "a, b, c" < => [("a" , ","), ("b" , "," ), ("c" , null)] "a, , c" < => [("a" , ","), (null, "," ), ("c" , null)] "a, b c" < => [("a" , ","), ("b" , null), ("c" , null)] "a, b," < => [("a" , ","), ("b" , "," ), (null, null)] In a terminated or maybe-terminated list: "a; b; c;" < => [("a" , ";"), ("b" , ";" ), ("c" , ";" )] "a; ; c;" < => [("a" , ";"), (null, ";" ), ("c" , ";" )] "a; b c;" < => [("a" , ";"), ("b" , null), ("c" , ";" )] "a; b; c" < => [("a" , ";"), ("b" , ";" ), ("c" , null)]
Declared at: clang/include/clang/Tooling/Syntax/Tree.h:283
¶clang::syntax::List::TerminationKind
getTerminationKind() const
clang::syntax::List::TerminationKind
getTerminationKind() const
Declared at: clang/include/clang/Tooling/Syntax/Tree.h:298