[cfe-dev] Parent of an AST node?
kremenek at apple.com
Thu Jul 31 16:25:00 PDT 2008
Check out the ParentMap class in libAST. It represents a map from
Stmt* -> Stmt* (children to parents). To construct it, you just
provide the root of the AST:
To query for a parent:
Stmt* parent = PM.getParent(child);
The parent map will only contain the backmapping from children to
parents that are descendants of the root AST node that you specified
when you constructed the parent map.
On Jul 31, 2008, at 3:44 PM, Nico Weber wrote:
> how can I get the parent of an AST node?
> I have a DeclRefExpr object and would like the name of the function
> it's contained in. Does clang offer this functionality or do I have to
> keep track of parents myself?
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
More information about the cfe-dev