This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
dump-translation-unit format
- From: "Sascha Alexander Jopen" <jopen at gmx dot net>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Fri, 9 Mar 2007 14:50:30 +0100
- Subject: dump-translation-unit format
Hi,
I'm currently working on the output of gcc/g++ -fdump-translation-unit to do
source code analysis. I found several references that the internal ast
should include nodes for for, while and do constructs. But I can't find
those nodes in the dumped files. Sometimes there are such FOR_STMT nodes
when I compile large units, but when compiling a small test unit containing
not much more than a for loop, this loop isn't included in the dump. Instead
there is a GOTO_EXPR where I would expect the for loop. This holds for other
loops and conditional expressions as well. All FOR_STMT nodes I encountered
where not from my custom code, but from templates from system includes.
Are there any optimizations done on the tree before dumping it, and how can
I prevent this to get an unoptimized tree? Are there other possibilities to
get those loop nodes? I need them to check whether function calls are done
in loops or not. Without the bodies of loops I can get information about
functions called from other functions using the chain links, but not whether
they are called within loops.
Another thing I don't understand is the following. This dumped function node
contains two body definitions, one undefined and one with a proper node
chain. Is this a dump error or has it special meaning?
@1639 function_decl name: @2001 mngl: @2002 type: @2003
scpe: @812 srcp: char_traits.h:322
chan: @2004 note: member accs: pub
args: @2005 body: undefined
link: extern body: @2006
Maybe someone could help me or point me to other resources.
Thanks in advance,
Sascha Jopen