clang 8.0.0

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:
[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 ASTContext & | getASTContext () const
StringRef | getFilename () const
int | getSize () const
NodeId | getRootId () const
PreorderIterator | begin () const
PreorderIterator | end () const
const Node & | getNode (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< Impl > | TreeImpl

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

using clang::diff::SyntaxTree::PreorderIterator = NodeId

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 972 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 986 of file ASTDiff.cpp.

References TreeImpl.

## ◆ end()

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

Definition at line 989 of file ASTDiff.cpp.

References TreeImpl.

## ◆ findPositionInParent()

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

Definition at line 991 of file ASTDiff.cpp.

References TreeImpl.

## ◆ getASTContext()

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

Definition at line 978 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 980 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 1011 of file ASTDiff.cpp.

References TreeImpl.

## ◆ getNodeValue() [2/2]

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

Definition at line 1015 of file ASTDiff.cpp.

References TreeImpl.

## ◆ getRootId()

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

Definition at line 985 of file ASTDiff.cpp.

References TreeImpl.

## ◆ getSize()

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

Definition at line 984 of file ASTDiff.cpp.

References TreeImpl.

## ◆ getSourceRangeOffsets()

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

Definition at line 996 of file ASTDiff.cpp.

References clang::diff::Node::ASTNode, Begin, End, clang::ast_type_traits::DynTypedNode::get(), clang::SourceRange::getBegin(), clang::SourceRange::getEnd(), clang::SourceManager::getExpansionLoc(), clang::SourceManager::getFileOffset(), clang::Lexer::getLocForEndOfToken(), clang::ast_type_traits::DynTypedNode::getSourceRange(), and TreeImpl.

## Member Data Documentation

## ◆ TreeImpl

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

Definition at line 100 of file ASTDiff.h.

Referenced by begin(), end(), findPositionInParent(), getASTContext(), clang::diff::ASTDiff::getMapped(), getNode(), getNodeValue(), getRootId(), getSize(), and getSourceRangeOffsets().

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

- include/clang/Tooling/ASTDiff/ASTDiff.h
- lib/Tooling/ASTDiff/ASTDiff.cpp