C-frontend NOP_EXPR help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I try to extract a source code syntax tree for c code from the c-frontend of the gcc. Therefore i have written a plugin which registers a callback for PLUGIN_PRE_GENERICIZE.

My problem is that the c-frontend directly breaks while-, do- and for-loops in statement list and
does not use FOR_STMT nodes like the c++-frontend.
To reconstruct this statement lists to a tree structure like the one in the c++ frontend i have added a few markings in struct tree_base. The gool is to have a node for the init, the condition, the increment and the body of the loop as children of the FOR_STMT node. But this reconstruction should only take
place in a seperate tree in my plugin not the c-frontend internal tree.
That works so far but not for empty do-loops with an always false condition:
    do {

    } while(0);

In this case in c-typeck.c:c_finish_loop() nothing is added to the frontend internal tree. My question is: Is it possible to add a NOP_EXPR, which has no further children, to the current
statement list. If yes how?
I could then set a few of my flags in tree_base for this NOP_EXPR and would be able to trac empty
do-loops.
If this is possible, am i right in the assumption that this NOP_EXPR is removed from the internal tree in later optimization steps but not before my PLUGIN_PRE_GENERICIZE callback was executed?

Thanks for your help and attention,
Markus



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux