[GCC-XML]Re-write prototype in CVS
Brad King
brad.king at kitware.com
Thu Mar 14 09:43:28 EST 2002
Dave,
> A parse tree is, well, a tree... so why would nesting be
> inappropriate? I don't know much about XML, but I'm under the
> impression there are ways to produce cross-references in an XML tree,
> resulting in an arbitrary graph.
Nesting is not inappropriate, which is why the first version used it.
However, I've found that it is much more convenient to do the dump as a
graph, and it comes out much shorter (both in implementation and in the
size of the output). When a partial dump is made, the connected subgraph
starting at a given set of nodes is traversed. The proper context
attributes are there so that any program reading the output can easily
reconstruct the nesting.
> Hmm, how about just making file/line available as an interface? I
> presume that information is still around by the time your backend gets
> ahold of the AST (or how would anyone write debuggers?)
I assume you mean to start at a declaration that is found at a given
file/line location. This may be hard to use because a one line change in
the source will need a new hand-written command line. I think you'll find
that the starting name is surprisingly easy to use. Most of the time,
people are interested in dumping header files. A cxx/cc/C/cpp/whatever
file still needs to be written to include the headers so that GCC will
read it. This file can contain a few extra lines to list the start
locations.
There is actually a better way I've now found to list the start locations:
#include "my_class.h"
void gccxml_instantiate()
{
sizeof(my_class<float>);
sizeof(my_class<int>);
}
namespace gccxml_start
{
typedef my_class<float> start1;
typedef my_class<int> start2;
// ... refer to everything of interest.
}
Then you can say -fxml-start=gccxml_start, and you're all set.
> Any chance you could post a sample somewhere, so I could get a sense
> for the new output without having to build the whole project?
The News section of the gccxml page has a link to example output from the
ostream class in gcc 2.95.3's library.
http://public.kitware.com/GCC_XML/HTML/News.html
> It would be great if these two projects developed some synergy. It
> would be interesting to write the interface glue between gcc-XML and
> synopsis in Python.
Thanks. I'll look at that project when I get a chance.
-Brad
More information about the gccxml
mailing list