Walking the Clang CFG

Hi,

I am currently walking each statement in a CFGBlock and I noticed something. When I have an expression like foo = bar(x,y). I get two statements in the CFG for this. One is the call expression on it’s own i.e bar(x,y) and another being foo = bar(x,y) (Binary Operator with DeclRefExpr and CallExpr children).

This is causing confusion in my algorithm because then I process that CallExpr twice. I added a hack basically which checks if the CallExpr has a parent that is a BinaryOp assignment but thats really … a hack.

My questions really are:

1- Why do we see the callexpr twice in the block ?
2- Is there a cleaner way to know if the CallExpr is in a statement which is an assignment and so not having to process it twice ?

Thanks