This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Finding all CALL_EXPR tree nodes during GENERIC
- From: Katsunori Kumatani <katsunori dot kumatani at gmail dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: GCC Development <gcc at gcc dot gnu dot org>
- Date: Tue, 21 Nov 2017 14:41:37 +0200
- Subject: Re: Finding all CALL_EXPR tree nodes during GENERIC
- Authentication-results: sourceware.org; auth=none
- References: <CAH0Jp5H0TpF48NN3kwtN=5jJBwL1jx-UP_UbNnHeQ2jSosco-A@mail.gmail.com> <712C7B76-227B-47C2-AEE4-540CD94DD9D5@gmail.com> <CAH0Jp5Gx_X+5RLYQNz85eiR00k-_p+v6sXTpxSnx23e0a2LZRA@mail.gmail.com> <CAFiYyc0WqvD9TQEEzmyuNVYfwWLxo037SMMv=rhtiPJ3tBUNaw@mail.gmail.com>
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.