[GCC-XML] Determining template parameter types
Brad King
brad.king at kitware.com
Mon Aug 4 13:49:23 EDT 2008
Chris Waldron wrote:
> Thanks for the tip and you have what looks like cool tool. However I've
> written my own tool to scan the resultant XML because I have a specific
> requirement. I could detemine the type from parsing the template
> parameters and matching the type names. However since GCC_XML contains
> the information, it should export it on the Class element. Also having
> the additional attribute will help to rapidly identify template class
> definitons.
There are two reasons I've held off doing this:
1.) The real solution is to have full dumping of uninstantiated
templates. Specification of arguments used for instantiation should be
in a form that references the template and then lists references to the
arguments.
2.) The project that funds gccxml development doesn't need it.
If anyone wants to contribute support for templates I can help get you
started.
-Brad
> -----Original Message-----
> From: Roman Yakovenko [mailto:roman.yakovenko at gmail.com]
> Sent: Saturday, August 02, 2008 10:07 AM
> To: Chris Waldron
> Cc: gccxml
> Subject: Re: [GCC-XML] Determining template parameter types
>
> On Sat, Aug 2, 2008 at 7:09 PM, Chris Waldron <cwaldron at intrinsyc.com>
> wrote:
>> As a feature request, it would nice if template parameter types can be
> added
>> as an attribute of the Class Element. For example:
>> template <typename P1, typename P2> TemplateClass {
>>
>>
>>
>> };
>>
>>
>>
>> class TemplateClass<void, int>
>>
>> {
>>
>>
>>
>> };
>>
>>
>>
>>
>>
>> <Class id="_10" name="TemplateClass<void,int*>" members="_23 _25
> _26
>> _27 _28 _29 _30 " bases="_21 _24 " tparams="_20 _21">
>>
>> <Base type="_21" access="public" virtual="0" offset="12"/>
>>
>> <Base type="_24" access="public" virtual="0" offset="0"/> </Class>
>>
>>
>>
>> The tparams attribute indicates the template parameter types defined
> on the
>> class. I cannot seem to find an easy way of determining the template
>> parameter types from the XML output.
>
> pygccxml does it right, in most cases:
> http://www.language-binding.net/pygccxml/apidocs/pygccxml.declarations.t
> emplates-module.html
>
More information about the gccxml
mailing list