I'm using clang to do some analysis and I need to find parent of a declaration in AST. For instance, in the following code I have int x
and I want to get its parent which should be the function declaration :
int main(int x) { return 0 }
I know as mentioned in this link http://comments.gmane.org/gmane.comp.compilers.clang.devel/2152 there is a ParentMap class to track parent nodes. However, this just represents a map from Stmt* -> Stmt* and I need to find parent of a declaration. Does anyone know how I could do this?