[GCC-XML] string in gccxml

Brad King brad.king at kitware.com
Fri Nov 12 17:44:38 EST 2004


Kedar Joshi wrote:
> I am still getting a lot of extra structs, methods,
> constructors/destructors, typedefs in the XML output file. Is there
> any way to get rid of these easily or not to produce them at all and
> still use the string class? (The generated output is not as big when i
> only use the Fundamental types like int, float, double, etc.)

The dump with -fxml-start dumps the declaration specified, everything it 
references, everything referenced by things it references, etc.  In 
practice this is usually needed to get anything useful out of the file 
anyway.  If you really do not want the extra declarations, it is easy to 
ignore them with a proper XML parser.

> Also, why does the struct show the name as below? instead of just
> something simple, like "basic_string"?
> 
> <Struct id="_2"
> name="basic_string<char,std::char_traits<char>,std::allocator<char>
> >" context="_5"...>

basic_string is a template.  Only instantiations of templates are 
dumped.  The full name of the instantiation that is referenced by the 
std::string typedef is the long basic_string<....> name because it has 
all the template arguments.  This is a consequence of the C++ standard 
library and has nothing to do with GCC-XML.

> I just want to get the method signatures of all the functions in my
> input file by parsing the XML output produced by gccxml.

You can use the file="fXX" attribute on each declaration to identify it 
as being in your source file.  That attribute references the File 
elements at the bottom of the dump.

-Brad



More information about the gccxml mailing list