clang  6.0.0svn
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
clang::diff::SyntaxTree Class Reference

SyntaxTree objects represent subtrees of the AST. More...

#include "clang/Tooling/ASTDiff/ASTDiff.h"

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

Classes

class  Impl
 Represents the AST of a TranslationUnit. More...
 

Public Types

using PreorderIterator = NodeId
 

Public Member Functions

 SyntaxTree (ASTContext &AST)
 Constructs a tree from a translation unit. More...
 
template<class T >
 SyntaxTree (T *Node, ASTContext &AST)
 Constructs a tree from any AST node. More...
 
 SyntaxTree (SyntaxTree &&Other)=default
 
 ~SyntaxTree ()
 
const ASTContextgetASTContext () const
 
StringRef getFilename () const
 
int getSize () const
 
NodeId getRootId () const
 
PreorderIterator begin () const
 
PreorderIterator end () const
 
const NodegetNode (NodeId Id) const
 
int findPositionInParent (NodeId Id) const
 
std::pair< unsigned, unsigned > getSourceRangeOffsets (const Node &N) const
 
std::string getNodeValue (NodeId Id) const
 Serialize the node attributes to a string representation. More...
 
std::string getNodeValue (const Node &Node) const
 

Public Attributes

std::unique_ptr< ImplTreeImpl
 

Detailed Description

SyntaxTree objects represent subtrees of the AST.

They can be constructed from any Decl or Stmt.

Definition at line 68 of file ASTDiff.h.

Member Typedef Documentation

◆ PreorderIterator

Definition at line 84 of file ASTDiff.h.

Constructor & Destructor Documentation

◆ SyntaxTree() [1/3]

clang::diff::SyntaxTree::SyntaxTree ( ASTContext AST)

Constructs a tree from a translation unit.

Definition at line 973 of file ASTDiff.cpp.

References ~SyntaxTree().

◆ SyntaxTree() [2/3]

template<class T >
clang::diff::SyntaxTree::SyntaxTree ( T Node,
ASTContext AST 
)
inline

Constructs a tree from any AST node.

Definition at line 74 of file ASTDiff.h.

◆ SyntaxTree() [3/3]

clang::diff::SyntaxTree::SyntaxTree ( SyntaxTree &&  Other)
default

◆ ~SyntaxTree()

clang::diff::SyntaxTree::~SyntaxTree ( )
default

Referenced by SyntaxTree().

Member Function Documentation

◆ begin()

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

Definition at line 987 of file ASTDiff.cpp.

References TreeImpl.

◆ end()

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

Definition at line 990 of file ASTDiff.cpp.

References TreeImpl.

◆ findPositionInParent()

int clang::diff::SyntaxTree::findPositionInParent ( NodeId  Id) const

Definition at line 992 of file ASTDiff.cpp.

References TreeImpl.

◆ getASTContext()

const ASTContext & clang::diff::SyntaxTree::getASTContext ( ) const

Definition at line 979 of file ASTDiff.cpp.

References TreeImpl.

◆ getFilename()

StringRef clang::diff::SyntaxTree::getFilename ( ) const

◆ getNode()

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

Definition at line 981 of file ASTDiff.cpp.

References TreeImpl.

◆ getNodeValue() [1/2]

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

Serialize the node attributes to a string representation.

This should uniquely distinguish nodes of the same kind. Note that this function just returns a representation of the node value, not considering descendants.

Definition at line 1012 of file ASTDiff.cpp.

References TreeImpl.

◆ getNodeValue() [2/2]

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

Definition at line 1016 of file ASTDiff.cpp.

References TreeImpl.

◆ getRootId()

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

Definition at line 986 of file ASTDiff.cpp.

References TreeImpl.

◆ getSize()

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

Definition at line 985 of file ASTDiff.cpp.

References TreeImpl.

◆ getSourceRangeOffsets()

std::pair< unsigned, unsigned > clang::diff::SyntaxTree::getSourceRangeOffsets ( const Node N) const

Member Data Documentation

◆ TreeImpl

std::unique_ptr<Impl> clang::diff::SyntaxTree::TreeImpl

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