help: from Stmt object to Decl

Hello, everyone.
I’m writing a checker for clang static analyzer.My test program is as follows:

int f()
struct list l;
if (l.size() == 0)
//printf(“equals zero\n”);

its ast nodes is :

-FunctionDecl 0x3b4bad0 <line:25:1, line:32:1> f 'int (void)' -CompoundStmt 0x3b4bf48 <line:26:1, line:32:1>

-DeclStmt 0x3b4be20 <line:27:2, col:15>
-VarDecl 0x3b4bbc0 <col:2, col:14> l 'struct list':'struct <anonymous>::list' -CXXConstructExpr 0x3b4bdf0 col:14 ‘struct list’:‘struct ::list’ ‘void (void)’
`-IfStmt 0x3b4bf18 <line:28:2, line:31:2>
-BinaryOperator 0x3b4bed8 <line:28:6, col:18> ‘_Bool’ ‘==’

-CXXMemberCallExpr 0x3b4be90 <col:6, col:13> ‘int’
-MemberExpr 0x3b4be60 <col:6, col:8> '<bound member function type>' .size 0x3b4b930 -DeclRefExpr 0x3b4be38 col:6 ‘struct list’:‘struct ::list’ lvalue Var 0x3b4bbc0 ‘l’ ‘struct list’:‘struct ::list’
-IntegerLiteral 0x3b4beb8 <col:18> 'int' 0 -CompoundStmt 0x3b4bf00 <line:29:2, line:31:2> -<<>>

now I have got the BinaryOperator object, but how could I get the Decl object that represents the function f ?
i.e how could I get the FunctionDecl object ?

Thanks for any suggestion.

i.e how could I get the FunctionDecl object ?

though not sure exactly what you would like to do, and what do you mean you
get the BinaryOperator here is a hint based on my "poor" experience. There
are to ways to find objects in AST:
-> using the visitor pattern
-> dynamic matchers. My favorite is to use the one based on matcher

For this one you may use the clang-query tool or the tool I wrote cmatch (, or look in the code how they query the
AST tree for certain types of nodes.