[GCC-XML]Re-write prototype in CVS

David Abrahams david.abrahams at rcn.com
Thu Mar 14 09:43:17 EST 2002


----- Original Message -----
From: "Brad King" <brad.king at kitware.com>

> 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.

Can't argue with that.

> > 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.

I'm one of those people. It seems obvious to say "start at line 1 of
foo.hpp". Does g++ refuse to compile a file if it has an .hpp extension?

> 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.

Are you telling me that GCC will refuse to compile a .hpp file based on
its extension?

> 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.

Arf. Are you telling me that it doesn't dump uninstantiated templates?

> > 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

Thanks!

-Dave





More information about the gccxml mailing list