[cfe-dev] looking "up" the tree in RecursiveASTVisitor?

David Blaikie via cfe-dev cfe-dev at lists.llvm.org
Thu Jan 28 08:07:54 PST 2016


I /think/ what you're looking for is the "ParentMap" - the AST doesn't have
one by default, but for many tools it's handy to build one (& there's one
available in Clang & used in many tools)

On Thu, Jan 28, 2016 at 6:01 AM, Noel Grandin via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hi
>
> Is there a straightforward way to look "up" the tree when implementing
> a clang plugin using RecursiveASTVisitor ?
>
> I've bumped into this a couple of times and never found a "nice" answer.
>
> For example, I have overridden
>
>        VisitCallExpr(const CallExpr* expr)
>
> and I want to know in which context the call is happening i.e. from
> which FunctionDecl the call is being made.
>
> It seems like there should be an easy way to walk back up the tree?
>
> Thanks, Noel Grandin
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160128/8c6b7969/attachment.html>


More information about the cfe-dev mailing list