clang: clang::ParentMapContext Class Reference (original) (raw)

#include "[clang/AST/ParentMapContext.h](ParentMapContext%5F8h%5Fsource.html)"

Public Member Functions
ParentMapContext (ASTContext &Ctx)
~ParentMapContext ()
template
DynTypedNodeList getParents (const NodeT &Node)
Returns the parents of the given node (within the traversal scope).
DynTypedNodeList getParents (const DynTypedNode &Node)
void clear ()
Clear parent maps.
TraversalKind getTraversalKind () const
void setTraversalKind (TraversalKind TK)
const Expr * traverseIgnored (const Expr *E) const
Expr * traverseIgnored (Expr *E) const
DynTypedNode traverseIgnored (const DynTypedNode &N) const

Definition at line 23 of file ParentMapContext.h.

ParentMapContext::ParentMapContext ( ASTContext & Ctx )

~ParentMapContext()

ParentMapContext::~ParentMapContext ( ) default

clear()

void ParentMapContext::clear ( )

getParents() [1/2]

getParents() [2/2]

template

DynTypedNodeList clang::ParentMapContext::getParents ( const NodeT & Node) inline

Returns the parents of the given node (within the traversal scope).

Note that this will lazily compute the parents of all nodes and store them for later retrieval. Thus, the first call is O(n) in the number of AST nodes.

Caveats and FIXMEs: Calculating the parent map over all AST nodes will need to load the full AST. This can be undesirable in the case where the full AST is expensive to create (for example, when using precompiled header preambles). Thus, there are good opportunities for optimization here. One idea is to walk the given node downwards, looking for references to declaration contexts - once a declaration context is found, compute the parent map for the declaration context; if that can satisfy the request, loading the whole AST can be avoided. Note that this is made more complex by statements in templates having multiple parents - those problems can be solved by building closure over the templated parts of the AST, which also avoids touching large parts of the AST. Additionally, we will want to add an interface to already give a hint where to search for the parents, for example when looking at a statement inside a certain function.

'NodeT' can be one of Decl, Stmt, Type, [TypeLoc](classclang%5F1%5F1TypeLoc.html "Base wrapper for a particular "section" of type source info."), [NestedNameSpecifier](classclang%5F1%5F1NestedNameSpecifier.html "Represents a C++ nested name specifier, such as "::std::vector::".") or NestedNameSpecifierLoc.

Definition at line 126 of file ParentMapContext.h.

References clang::DynTypedNode::create(), and getParents().

Referenced by clang::ASTContext::getParents(), clang::ASTContext::getParents(), getParents(), isInCondition(), and matchesPostDecrInWhile().

getTraversalKind()

TraversalKind clang::ParentMapContext::getTraversalKind ( ) const inline

setTraversalKind()

void clang::ParentMapContext::setTraversalKind ( TraversalKind TK) inline

traverseIgnored() [1/3]

traverseIgnored() [2/3]

const Expr * ParentMapContext::traverseIgnored ( const Expr * E ) const

traverseIgnored() [3/3]

Expr * ParentMapContext::traverseIgnored ( Expr * E ) const

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