clang  14.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. More...
 
 Impl (SyntaxTree *Parent, Stmt *N, ASTContext &AST)
 
template<class T >
 Impl (SyntaxTree *Parent, std::enable_if_t< std::is_base_of< Stmt, T >::value, T > *Node, ASTContext &AST)
 
template<class T >
 Impl (SyntaxTree *Parent, std::enable_if_t< std::is_base_of< Decl, T >::value, 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. More...
 
std::vector< NodeIdLeaves
 
std::vector< intPostorderIds
 
std::vector< NodeIdNodesBfs
 

Detailed Description

Represents the AST of a TranslationUnit.

Definition at line 112 of file ASTDiff.cpp.

Constructor & Destructor Documentation

◆ Impl() [1/5]

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

Definition at line 262 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 267 of file ASTDiff.cpp.

◆ Impl() [3/5]

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

Definition at line 274 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< Stmt, T >::value, T > *  Node,
ASTContext AST 
)
inline

Definition at line 119 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< Decl, T >::value, 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 147 of file ASTDiff.cpp.

References Nodes.

◆ begin()

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

Definition at line 141 of file ASTDiff.cpp.

◆ end()

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

Definition at line 142 of file ASTDiff.cpp.

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

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

◆ getMutableNode()

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

Definition at line 145 of file ASTDiff.cpp.

References Id, and Nodes.

◆ getNode()

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

Definition at line 144 of file ASTDiff.cpp.

References Id, and Nodes.

◆ getNodeValue() [1/2]

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

Definition at line 413 of file ASTDiff.cpp.

References clang::diff::Node::ASTNode.

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

◆ 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 clang::NamedDecl::getQualifiedNameAsString(), and string().

◆ getRootId()

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

Definition at line 140 of file ASTDiff.cpp.

◆ getSize()

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

Definition at line 139 of file ASTDiff.cpp.

References Nodes.

◆ getStmtValue()

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

Definition at line 447 of file ASTDiff.cpp.

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

References Id.

Member Data Documentation

◆ AST

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

Definition at line 130 of file ASTDiff.cpp.

◆ Leaves

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

Definition at line 134 of file ASTDiff.cpp.

◆ Nodes

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

Nodes in preorder.

Definition at line 133 of file ASTDiff.cpp.

◆ NodesBfs

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

Definition at line 137 of file ASTDiff.cpp.

◆ Parent

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

Definition at line 129 of file ASTDiff.cpp.

◆ PostorderIds

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

Definition at line 136 of file ASTDiff.cpp.

◆ TypePP

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

Definition at line 131 of file ASTDiff.cpp.

Referenced by Impl().


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