clang: clang::syntax::Tree Class Reference (original) (raw)
A node that has children and represents a syntactic language construct. More...
#include "[clang/Tooling/Syntax/Tree.h](Tree%5F8h%5Fsource.html)"
Classes | |
---|---|
struct | ChildIterator |
child_iterator is not invalidated by mutations. More... | |
struct | ConstChildIterator |
Public Member Functions | |
---|---|
Node * | getFirstChild () |
const Node * | getFirstChild () const |
Node * | getLastChild () |
const Node * | getLastChild () const |
const Leaf * | findFirstLeaf () const |
Leaf * | findFirstLeaf () |
const Leaf * | findLastLeaf () const |
Leaf * | findLastLeaf () |
llvm::iterator_range< ChildIterator > | getChildren () |
llvm::iterator_range< ConstChildIterator > | getChildren () const |
const Node * | findChild (NodeRole R) const |
Find the first node with a corresponding role. | |
Node * | findChild (NodeRole R) |
![]() |
|
Node (const Node &)=delete | |
Nodes cannot simply be copied without violating tree invariants. | |
Node & | operator= (const Node &)=delete |
Node (Node &&)=delete | |
Idiomatically, nodes are allocated on an Arena and never moved. | |
Node & | operator= (Node &&)=delete |
NodeKind | getKind () const |
NodeRole | getRole () const |
bool | isDetached () const |
Whether the node is detached from a tree, i.e. does not have a parent. | |
bool | isOriginal () const |
Whether the node was created from the AST backed by the source code rather than added later through mutation APIs or created with factory functions. | |
bool | canModify () const |
If this function return false, the tree cannot be modified because there is no reasonable way to produce the corresponding textual replacements. | |
const Tree * | getParent () const |
Tree * | getParent () |
const Node * | getNextSibling () const |
Node * | getNextSibling () |
const Node * | getPreviousSibling () const |
Node * | getPreviousSibling () |
std::string | dump (const TokenManager &SM) const |
Dumps the structure of a subtree. For debugging and testing purposes. | |
std::string | dumpTokens (const TokenManager &SM) const |
Dumps the tokens forming this subtree. | |
void | assertInvariants () const |
Asserts invariants on this node of the tree and its immediate children. | |
void | assertInvariantsRecursive () const |
Runs checkInvariants on all nodes in the subtree. No-op if NDEBUG is set. | |
Protected Member Functions |
---|
![]() |
Friends | |
---|---|
class | TreeBuilder |
class | FactoryImpl |
class | MutationsImpl |
A node that has children and represents a syntactic language construct.
Definition at line 144 of file Tree.h.
◆ classof()
static bool clang::syntax::Tree::classof ( const Node * N) | static |
---|
◆ findChild() [1/2]
◆ findChild() [2/2]
◆ findFirstLeaf() [1/2]
Leaf * clang::syntax::Tree::findFirstLeaf ( ) | inline |
---|
◆ findFirstLeaf() [2/2]
◆ findLastLeaf() [1/2]
Leaf * clang::syntax::Tree::findLastLeaf ( ) | inline |
---|
◆ findLastLeaf() [2/2]
◆ getChildren() [1/2]
llvm::iterator_range< ChildIterator > clang::syntax::Tree::getChildren ( ) | inline |
---|
◆ getChildren() [2/2]
llvm::iterator_range< ConstChildIterator > clang::syntax::Tree::getChildren ( ) const | inline |
---|
◆ getFirstChild() [1/2]
Node * clang::syntax::Tree::getFirstChild ( ) | inline |
---|
◆ getFirstChild() [2/2]
const Node * clang::syntax::Tree::getFirstChild ( ) const | inline |
---|
Definition at line 180 of file Tree.h.
◆ getLastChild() [1/2]
Node * clang::syntax::Tree::getLastChild ( ) | inline |
---|
Definition at line 181 of file Tree.h.
◆ getLastChild() [2/2]
const Node * clang::syntax::Tree::getLastChild ( ) const | inline |
---|
Definition at line 182 of file Tree.h.
◆ Node() [1/3]
clang::syntax::Node::Node ( const Node & ) | protecteddelete |
---|
Nodes cannot simply be copied without violating tree invariants.
◆ Node() [2/3]
clang::syntax::Node::Node ( Node && ) | protecteddelete |
---|
Idiomatically, nodes are allocated on an Arena and never moved.
◆ Node() [3/3]
syntax::Node::Node ( NodeKind Kind) | protected |
---|
Newly created nodes are detached from a tree, parent and sibling links are set when the node is added as a child to another one.
Definition at line 58 of file Tree.cpp.
◆ FactoryImpl
◆ MutationsImpl
◆ TreeBuilder
The documentation for this class was generated from the following files: