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.
Thanks in advance!
If the FunctionDecl is a CXXMethodDecl, then it is a class member. So, either search for CXXMethodDecl directly, or see if the FunctionDecl is a CXXMethodDecl.
Check whether it's a clang::CXXMethodDecl?
Use RecursiveASTVisitor.h, put your code in VisitFunctionDecl() and test for !isa(FunctionDecl *FD).
Problem solved! Both solutions worked. Thank you very much for your answers