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

Inherited from Tree:

Inherited from Node:

Methods

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)

Declared at: clang/include/clang/Tooling/Syntax/Tree.h:268

Parameters

const clang::syntax::Node* N

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()

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()

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

Declared at: clang/include/clang/Tooling/Syntax/Tree.h:298