On Mon, Nov 20, 2017 at 12:32 PM, Richard Biener <richard.guent...@gmail.com> wrote: > On Sun, Nov 19, 2017 at 9:27 PM, Katsunori Kumatani > <katsunori.kumat...@gmail.com> wrote: >> Yes, it seems walk_tree does the job, I was probably doing something >> wrong before. Thank you. >> >> I have a question about it. Am I correct in assuming I only have to >> check the subtrees of nodes that satisfy EXPR_P? So for nodes that >> aren't EXPR_P, can I just set *walkSubtrees to 0, or will that miss >> some CALL_EXPRs? In my tests, none were missed, but I don't know if >> this is all-encompassing for C/C++ generated AST. > > You'd have to experiment, it depends on the C/C++ AST. You should be > able to skip TYPE_P though. >
You're right, one example would be variable initialization. I realized the exprs are found within its DECL_INITIAL, which is part of a VAR_DECL (and so not an expr). I'll stick to TYPE_P then, thanks.