clang 17.0.0git
Public Member Functions | Public Attributes | List of all members
clang::diff::SyntaxTree::Impl Class Reference

Represents the AST of a TranslationUnit. More...

Collaboration diagram for clang::diff::SyntaxTree::Impl:
Collaboration graph
[legend]

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 NodegetNode (NodeId Id) const
 
NodegetMutableNode (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

SyntaxTreeParent
 
ASTContextAST
 
PrintingPolicy TypePP
 
std::vector< NodeNodes
 Nodes in preorder.
 
std::vector< NodeIdLeaves
 
std::vector< intPostorderIds
 
std::vector< NodeIdNodesBfs
 

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 clang::PrintingPolicy::AnonymousTagLocations, and TypePP.

◆ Impl() [2/5]

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

Constructs a tree from an AST node.

Definition at line 266 of file ASTDiff.cpp.

◆ Impl() [3/5]

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

Definition at line 273 of file ASTDiff.cpp.

◆ 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.

◆ 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.

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

Definition at line 423 of file ASTDiff.cpp.

References clang::Lexer::getSourceText(), and V.

◆ getMutableNode()

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

Definition at line 144 of file ASTDiff.cpp.

References Id, and Nodes.

◆ getNode()

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

Definition at line 143 of file ASTDiff.cpp.

References Id, and Nodes.

◆ 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 379 of file ASTDiff.cpp.

References clang::Decl::getDeclContext().

◆ getRelativeName() [2/2]

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

Definition at line 358 of file ASTDiff.cpp.

References clang::NamedDecl::getQualifiedNameAsString().

◆ 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(), and Id.

Member Data Documentation

◆ AST

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

Definition at line 129 of file ASTDiff.cpp.

◆ 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.

◆ 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 Impl().


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