This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Finding all CALL_EXPR tree nodes during GENERIC


On Mon, Nov 20, 2017 at 12:32 PM, Richard Biener
<richard.guenther@gmail.com> wrote:
> On Sun, Nov 19, 2017 at 9:27 PM, Katsunori Kumatani
> <katsunori.kumatani@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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]