[GCC-XML]gccxml and templates?

Brad King brad.king at kitware.com
Mon Oct 20 13:27:46 EDT 2003


On Fri, 17 Oct 2003 andy.glew at amd.com wrote:

> Found GCC-XML.  It's definitely along the right path, using full GCC/G++
> to parse, emitting XML.
>
> Q: GCC-XML handles nested classes, but doesn't appear to support
> templates.
>
> Can anyone tell me this ain't so?

It does support templates, but the dump currently does not include
uninstantiated templates.  The dump will include any instantiated
templates in the translation unit. Try running GCC-XML on this program:

template <class T> struct A {};

// Using :: to access a member forces instantiation:
typedef A<int>::A A_int;

This may be sufficient for your purposes because you have to instantiate a
class template before it is useful anyway.  You can generate print
functions/accessors for any instantiations your program uses.

-Brad




More information about the gccxml mailing list