<div dir="ltr"><span style="font-size:12.8px">Hi All</span><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I'm trying to find code matching the below pattern</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">====</div><div style="font-size:12.8px">...</div><div style="font-size:12.8px">if (foo->bar->data_x) {</div><div style="font-size:12.8px">...</div><div style="font-size:12.8px">====</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">I'm trying to find all references to the type of 'bar' appearing within an if statement, and with each reference, list the struct member being accessed within type 'bar' (be it data_x, or data_y or data_z). The dereference "hierarchy" may be variable (i.e to get to the type of 'bar'), but it should always contain the type of 'bar' before accessing the last member.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">After dumping an example AST and observing the structure of 'IfStmt', it looks like I need to finger on 'DeclRefExpr'. But when I check the type, it is always of the 'top' of the hierarchy (i.e the 'spelling' attribute will report 'foo').</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">My question is how do I get from here to the rest of the chain of struct dereferences, and finally to the member declaration of the struct of type 'bar'?</div></div>