class SyntaxTree

Declaration

class SyntaxTree { /* full declaration omitted */ };

Description

SyntaxTree objects represent subtrees of the AST. They can be constructed from any Decl or Stmt.

Declared at: clang/include/clang/Tooling/ASTDiff/ASTDiff.h:53

Member Variables

public std::unique_ptr<Impl> TreeImpl

Method Overview

  • public SyntaxTree(clang::ASTContext & AST)
  • public SyntaxTree(clang::diff::SyntaxTree && Other)
  • public template <class T> SyntaxTree(T * Node, clang::ASTContext & AST)
  • public clang::diff::SyntaxTree::PreorderIterator begin() const
  • public clang::diff::SyntaxTree::PreorderIterator end() const
  • public int findPositionInParent(clang::diff::NodeId Id) const
  • public const clang::ASTContext & getASTContext() const
  • public llvm::StringRef getFilename() const
  • public const clang::diff::Node & getNode(clang::diff::NodeId Id) const
  • public std::string getNodeValue(clang::diff::NodeId Id) const
  • public std::string getNodeValue(const clang::diff::Node & Node) const
  • public clang::diff::NodeId getRootId() const
  • public int getSize() const
  • public std::pair<unsigned int, unsigned int> getSourceRangeOffsets(const clang::diff::Node & N) const
  • public ~SyntaxTree()

Methods

SyntaxTree(clang::ASTContext& AST)

Description

Constructs a tree from a translation unit.

Declared at: clang/include/clang/Tooling/ASTDiff/ASTDiff.h:56

Parameters

clang::ASTContext& AST

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

Declared at: clang/include/clang/Tooling/ASTDiff/ASTDiff.h:61

Parameters

clang::diff::SyntaxTree&& Other

template <class T>
SyntaxTree(T* Node, clang::ASTContext& AST)

Description

Constructs a tree from any AST node.

Declared at: clang/include/clang/Tooling/ASTDiff/ASTDiff.h:59

Templates

T

Parameters

T* Node
clang::ASTContext& AST

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

Declared at: clang/include/clang/Tooling/ASTDiff/ASTDiff.h:70

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

Declared at: clang/include/clang/Tooling/ASTDiff/ASTDiff.h:71

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

Declared at: clang/include/clang/Tooling/ASTDiff/ASTDiff.h:74

Parameters

clang::diff::NodeId Id

const clang::ASTContext& getASTContext() const

Declared at: clang/include/clang/Tooling/ASTDiff/ASTDiff.h:64

llvm::StringRef getFilename() const

Declared at: clang/include/clang/Tooling/ASTDiff/ASTDiff.h:65

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

Declared at: clang/include/clang/Tooling/ASTDiff/ASTDiff.h:73

Parameters

clang::diff::NodeId Id

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

Description

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.

Declared at: clang/include/clang/Tooling/ASTDiff/ASTDiff.h:82

Parameters

clang::diff::NodeId Id

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

Declared at: clang/include/clang/Tooling/ASTDiff/ASTDiff.h:83

Parameters

const clang::diff::Node& Node

clang::diff::NodeId getRootId() const

Declared at: clang/include/clang/Tooling/ASTDiff/ASTDiff.h:68

int getSize() const

Declared at: clang/include/clang/Tooling/ASTDiff/ASTDiff.h:67

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

Declared at: clang/include/clang/Tooling/ASTDiff/ASTDiff.h:77

Parameters

const clang::diff::Node& N

~SyntaxTree()

Declared at: clang/include/clang/Tooling/ASTDiff/ASTDiff.h:62