clang 8.0.0

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:
[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, typename std::enable_if< std::is_base_of< Stmt, T >::value, T >::type *Node, ASTContext &AST)
template<class T >
| Impl (SyntaxTree *Parent, typename std::enable_if< std::is_base_of< Decl, T >::value, T >::type *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. More...
std::vector< NodeId > | Leaves
std::vector< int > | PostorderIds
std::vector< NodeId > | NodesBfs

## 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,
|  | typename std::enable_if< std::is_base_of< Stmt, T >::value, T >::type * | 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,
|  | typename std::enable_if< std::is_base_of< Decl, T >::value, T >::type * | 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 Id.

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

Definition at line 339 of file ASTDiff.cpp.

References clang::diff::Node::Children, getNode(), clang::diff::NodeId::isInvalid(), clang::diff::Node::Parent, and Parent.

## ◆ getDeclValue()

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

Definition at line 424 of file ASTDiff.cpp.

References AST, clang::ASTContext::getLangOpts(), getRelativeName(), clang::ASTContext::getSourceManager(), clang::Lexer::getSourceText(), and TypePP.

## ◆ getMutableNode()

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

Definition at line 145 of file ASTDiff.cpp.

References Id.

Referenced by clang::diff::getSubtreeBfs().

## ◆ getNode()

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

Definition at line 144 of file ASTDiff.cpp.

References Id.

Referenced by findPositionInParent(), clang::diff::Node::getIdentifier(), clang::diff::Subtree::getNode(), getNodeValue(), clang::diff::Subtree::getNodeValue(), getNumberOfDescendants(), clang::diff::getSubtreeBfs(), clang::diff::getSubtreePostorder(), and isInSubtree().

## ◆ getNodeValue() [1/2]

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

Definition at line 409 of file ASTDiff.cpp.

References getNode().

Referenced by clang::diff::Subtree::getNodeValue().

## ◆ getNodeValue() [2/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.

## ◆ getNumberOfDescendants()

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

Definition at line 331 of file ASTDiff.cpp.

References getNode(), and clang::diff::Node::RightMostDescendant.

## ◆ getRelativeName() [1/2]

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

Definition at line 359 of file ASTDiff.cpp.

Referenced by getDeclValue(), and getRelativeName().

## ◆ getRelativeName() [2/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().

## ◆ getRootId()

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

Definition at line 140 of file ASTDiff.cpp.

Referenced by clang::diff::getSubtreeBfs().

## ◆ getSize()

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

Definition at line 139 of file ASTDiff.cpp.

Referenced by clang::diff::Subtree::getIdInRoot(), clang::diff::Subtree::getLeftMostDescendant(), clang::diff::Subtree::getNodeValue(), and clang::diff::getSubtreeBfs().

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

Definition at line 335 of file ASTDiff.cpp.

References getNode(), and clang::diff::Node::RightMostDescendant.

## ◆ isValidNodeId()

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

Definition at line 146 of file ASTDiff.cpp.

## Member Data Documentation

## ◆ AST

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

Definition at line 130 of file ASTDiff.cpp.

Referenced by getDeclValue().

## ◆ Leaves

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

Definition at line 134 of file ASTDiff.cpp.

Referenced by clang::diff::Subtree::getNodeValue(), and clang::diff::getSubtreeBfs().

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

Referenced by clang::diff::getSubtreeBfs().

## ◆ Parent

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

Definition at line 129 of file ASTDiff.cpp.

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

## ◆ PostorderIds

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

Definition at line 136 of file ASTDiff.cpp.

Referenced by clang::diff::Subtree::getNodeValue(), clang::diff::Subtree::getPostorderOffset(), and clang::diff::getSubtreeBfs().

## ◆ TypePP

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

Definition at line 131 of file ASTDiff.cpp.

Referenced by getDeclValue(), and Impl().

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

- lib/Tooling/ASTDiff/ASTDiff.cpp