This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Howto dump syntax tree of erroneous program?
- From: Bob Gustafson <bobgus at rcn dot com>
- To: gcc at gcc dot gnu dot org
- Date: Fri, 26 Nov 2004 11:23:57 -0600
- Subject: Howto dump syntax tree of erroneous program?
- Reply-to: bobgus at rcn dot com
I have a heavily templated C++ program (w/ macros too), written by
someone else, which compiles and runs using an earlier version of g++
(but not by me).
I have managed to find a number of tweeks (this-> additions) which
enable the compile to move along. However, I am stumped at the moment.
I have used -E, -Q, -dy, and -save-temps options to g++, but the info
obtained is not quite enough. I could use something that would dump the
source code file name, line number, name of syntactic element observed
(e.g., template, non-type template-parameter, template specialization,
etc.) and the source text snippet at that point.
This is just an aid so that I can be sure that the compiler and I are
thinking about the same thing in the same way.
The output could be spit out as an xml file. XSLT post-processor tools
would spring up to handle that format.
Does this exist already? If not, what piece of gcc compiler code would I
hack to product this output?
It appears as though there might be some promising code chunks in gcc/cp
(parser.c, semantics.c, ..). Would these be a good starting point?
Thanks for any replies.
BobG