[GCC-XML]extra tags needed

Brad King brad.king at kitware.com
Tue Feb 12 15:47:45 EST 2002


Kevin,

> Has there been any thought about using the MoML representation as the
> new format?

I thought about it, but I decided that the result would still be too
verbose.  I realized that the information dumped should be as simple as
possible.  Someone could always write their own tool to translate GCC-XML
output into MoML.  In fact, this would be the preferred option because
this tool could take the location markers from the xml and go find the
comments in the source code associated with the declarations.  The MoML
could then include the comments as annotations.  This functionality is too
application specific to put right in GCC-XML.

The new format is going to be much more useful for programs that want to
analyze the C++ code.  The old format just dumped all the declarations in
an XML syntax and required the parser to do the same name lookups the
compiler has already done.  The new format will be graph-like, with very
little nesting.  Rather than having a namespace with all its declarations
nested inside, the format might look more like this:

<Namespace id="0" name="foo" declarations="1 2"/>
<Class id="1" name="bar" context="0" fields="..."/>
<Function id="2" name="zot" context="0" returns="..." arguments="..."/>

This will have the advantage that all name lookups have been done already,
and the XML parser won't have to do anything but lookup the id in a table.
It will also make for shorter output, since every entity will be only one
line.

I'm not sure how far this graph abstraction should go.  I might create a
balance between this and nesting.  For example, the fields in a Class can
never be used by another class, so they could be nested inside the Class
element.  This would help with human readability, too.  I don't want it to
turn into an XML version of the dump-translation-unit feature already in
GCC.

Comments welcome,
-Brad




More information about the gccxml mailing list