This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
How to run over each node of a tree ?
- From: Matthieu Moy <Matthieu dot Moy at imag dot fr>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 20 May 2003 11:16:38 +0200
- Subject: How to run over each node of a tree ?
- Organization: Verimag, STMicroelectronics
Hi,
I want to do a complete run over a tree (GCC AST).
Basically, this is a recursive function with a switch statement on the
TREE_CODE of the top of the tree.
But is there a way to be sure I didn't forget any case. For example,
on a WHILE_STMT, I may have forgoten to explore the WHILE_COND, or
something like this.
In particular, how can I know wether a node has a TREE_CHAIN field ?
This field sometimes points to a junk value (Not NULL, not a tree ...)
Thanks for your help,
--
Matthieu