clang 24.0.0git
clang::diff::SyntaxTree::Impl Class Reference

Represents the AST of a TranslationUnit. More...

Public Member Functions

 Impl (SyntaxTree *Parent, ASTContext &AST)
 Impl (SyntaxTree *Parent, Decl *N, ASTContext &AST)
 Constructs a tree from an AST node.
 Impl (SyntaxTree *Parent, Stmt *N, ASTContext &AST)
template<class T>
 Impl (SyntaxTree *Parent, std::enable_if_t< std::is_base_of_v< Stmt, T >, T > *Node, ASTContext &AST)
template<class T>
 Impl (SyntaxTree *Parent, std::enable_if_t< std::is_base_of_v< Decl, T >, T > *Node, ASTContext &AST)
int getSize () const
NodeId getRootId () const
PreorderIterator begin () const
PreorderIterator end () const
const Node & getNode (NodeId Id) const
Node & getMutableNode (NodeId Id)
bool isValidNodeId (NodeId Id) const
void addNode (Node &N)
int getNumberOfDescendants (NodeId Id) const
bool isInSubtree (NodeId Id, NodeId SubtreeRoot) const
int findPositionInParent (NodeId Id, bool Shifted=false) const
std::string getRelativeName (const NamedDecl *ND, const DeclContext *Context) const
std::string getRelativeName (const NamedDecl *ND) const
std::string getNodeValue (NodeId Id) const
std::string getNodeValue (const Node &Node) const
std::string getDeclValue (const Decl *D) const
std::string getStmtValue (const Stmt *S) const

Public Attributes

SyntaxTree * Parent
ASTContext & AST
PrintingPolicy TypePP
std::vector< Node > Nodes
 Nodes in preorder.
std::vector< NodeId > Leaves
std::vector< int > PostorderIds
std::vector< NodeId > NodesBfs

Detailed Description

Represents the AST of a TranslationUnit.

Definition at line 113 of file ASTDiff.cpp.

Constructor & Destructor Documentation

◆ Impl() [1/5]

clang::diff::SyntaxTree::Impl::Impl ( SyntaxTree * Parent,
ASTContext & AST )

Definition at line 261 of file ASTDiff.cpp.

References AST, Parent, clang::PrintingPolicy::Plain, clang::diff::SyntaxTree::SyntaxTree(), and TypePP.

Referenced by Impl(), Impl(), Impl(), and Impl().

◆ Impl() [2/5]

clang::diff::SyntaxTree::Impl::Impl ( SyntaxTree * Parent,
Decl * N,
ASTContext & AST )

Constructs a tree from an AST node.

Definition at line 267 of file ASTDiff.cpp.

References AST, Impl(), Parent, and clang::diff::SyntaxTree::SyntaxTree().

◆ Impl() [3/5]

clang::diff::SyntaxTree::Impl::Impl ( SyntaxTree * Parent,
Stmt * N,
ASTContext & AST )

Definition at line 274 of file ASTDiff.cpp.

References AST, Impl(), Parent, and clang::diff::SyntaxTree::SyntaxTree().

◆ Impl() [4/5]

template<class T>
clang::diff::SyntaxTree::Impl::Impl ( SyntaxTree * Parent,
std::enable_if_t< std::is_base_of_v< Stmt, T >, T > * Node,
ASTContext & AST )
inline

Definition at line 120 of file ASTDiff.cpp.

References AST, Impl(), Parent, clang::diff::SyntaxTree::SyntaxTree(), and clang::T.

◆ Impl() [5/5]

template<class T>
clang::diff::SyntaxTree::Impl::Impl ( SyntaxTree * Parent,
std::enable_if_t< std::is_base_of_v< Decl, T >, T > * Node,
ASTContext & AST )
inline

Definition at line 124 of file ASTDiff.cpp.

References AST, Impl(), Parent, clang::diff::SyntaxTree::SyntaxTree(), and clang::T.

Member Function Documentation

◆ addNode()

void clang::diff::SyntaxTree::Impl::addNode ( Node & N)
inline

Definition at line 146 of file ASTDiff.cpp.

References Nodes.

◆ begin()

PreorderIterator clang::diff::SyntaxTree::Impl::begin ( ) const
inline

Definition at line 140 of file ASTDiff.cpp.

References getRootId().

◆ end()

PreorderIterator clang::diff::SyntaxTree::Impl::end ( ) const
inline

Definition at line 141 of file ASTDiff.cpp.

References getSize().

◆ findPositionInParent()

int clang::diff::SyntaxTree::Impl::findPositionInParent ( NodeId Id,
bool Shifted = false ) const

◆ getDeclValue()

std::string clang::diff::SyntaxTree::Impl::getDeclValue ( const Decl * D) const

◆ getMutableNode()

Node & clang::diff::SyntaxTree::Impl::getMutableNode ( NodeId Id)
inline

Definition at line 144 of file ASTDiff.cpp.

References Nodes.

◆ getNode()

const Node & clang::diff::SyntaxTree::Impl::getNode ( NodeId Id) const
inline

Definition at line 143 of file ASTDiff.cpp.

References Nodes.

Referenced by clang::diff::getSubtreeBfs(), and clang::diff::getSubtreePostorder().

◆ getNodeValue() [1/2]

std::string clang::diff::SyntaxTree::Impl::getNodeValue ( const Node & Node) const

◆ getNodeValue() [2/2]

std::string clang::diff::SyntaxTree::Impl::getNodeValue ( NodeId Id) const

◆ getNumberOfDescendants()

int clang::diff::SyntaxTree::Impl::getNumberOfDescendants ( NodeId Id) const

◆ getRelativeName() [1/2]

std::string clang::diff::SyntaxTree::Impl::getRelativeName ( const NamedDecl * ND) const

Definition at line 380 of file ASTDiff.cpp.

References clang::Decl::getDeclContext(), and getRelativeName().

◆ getRelativeName() [2/2]

std::string clang::diff::SyntaxTree::Impl::getRelativeName ( const NamedDecl * ND,
const DeclContext * Context ) const

Definition at line 359 of file ASTDiff.cpp.

References AST, and clang::NamedDecl::getQualifiedNameAsString().

Referenced by getDeclValue(), getRelativeName(), and getStmtValue().

◆ getRootId()

NodeId clang::diff::SyntaxTree::Impl::getRootId ( ) const
inline

Definition at line 139 of file ASTDiff.cpp.

Referenced by begin().

◆ getSize()

int clang::diff::SyntaxTree::Impl::getSize ( ) const
inline

Definition at line 138 of file ASTDiff.cpp.

References Nodes.

Referenced by end(), and isValidNodeId().

◆ getStmtValue()

std::string clang::diff::SyntaxTree::Impl::getStmtValue ( const Stmt * S) const

◆ isInSubtree()

bool clang::diff::SyntaxTree::Impl::isInSubtree ( NodeId Id,
NodeId SubtreeRoot ) const

◆ isValidNodeId()

bool clang::diff::SyntaxTree::Impl::isValidNodeId ( NodeId Id) const
inline

Definition at line 145 of file ASTDiff.cpp.

References getSize().

Member Data Documentation

◆ AST

ASTContext& clang::diff::SyntaxTree::Impl::AST

Definition at line 129 of file ASTDiff.cpp.

Referenced by getDeclValue(), getRelativeName(), getStmtValue(), Impl(), Impl(), Impl(), Impl(), and Impl().

◆ Leaves

std::vector<NodeId> clang::diff::SyntaxTree::Impl::Leaves

Definition at line 133 of file ASTDiff.cpp.

◆ Nodes

std::vector<Node> clang::diff::SyntaxTree::Impl::Nodes

Nodes in preorder.

Definition at line 132 of file ASTDiff.cpp.

Referenced by addNode(), getMutableNode(), getNode(), and getSize().

◆ NodesBfs

std::vector<NodeId> clang::diff::SyntaxTree::Impl::NodesBfs

Definition at line 136 of file ASTDiff.cpp.

◆ Parent

SyntaxTree* clang::diff::SyntaxTree::Impl::Parent

Definition at line 128 of file ASTDiff.cpp.

Referenced by findPositionInParent(), Impl(), Impl(), Impl(), Impl(), and Impl().

◆ PostorderIds

std::vector<int> clang::diff::SyntaxTree::Impl::PostorderIds

Definition at line 135 of file ASTDiff.cpp.

◆ TypePP

PrintingPolicy clang::diff::SyntaxTree::Impl::TypePP

Definition at line 130 of file ASTDiff.cpp.

Referenced by getDeclValue(), getNodeValue(), and Impl().


The documentation for this class was generated from the following file: