[cfe-dev] How to identify if a FunctionDecl is member of a class.

Yaron Keren yaron.keren at gmail.com
Thu Jul 3 23:42:03 PDT 2014


Use RecursiveASTVisitor.h, put your code in VisitFunctionDecl() and test
for !isa<CXXMethodDecl>(FunctionDecl *FD).

Yaron



2014-07-04 1:16 GMT+03:00 James Dennett <james.dennett at gmail.com>:

> On Thu, Jul 3, 2014 at 10:11 PM, Greenwalker <panagos13 at hotmail.com>
> wrote:
> > Hi all!
> >
> > Is there a way to identify if a FunctionDecl is a declaration of a
> function
> > that belongs (or not) to a class ?
> >
> > I am trying to build a visitor which should only visit function
> declarations
> > that are not members of any class.
>
> Check whether it's a clang::CXXMethodDecl?
>
> -- James
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140704/11963a16/attachment.html>


More information about the cfe-dev mailing list