[Dwarf-Discuss] Dwarf-Discuss Digest, Vol 27, Issue 2

Kendrick Wong kendrick at ca.ibm.com
Fri Aug 28 14:47:26 PDT 2009


> template <template <class> class T>
> struct A
> {
>    int f() { T<int> t; return t.u; }
> };
>
> template <class U>
> struct B
> {
>    U u;
> };
>
> int main()
> {
>    A<B> a;
>    a.f();
> }
> within A<B>::f() we can ask the debugger what T<int> looks like, and it 
> can think "well, T is a template template parameter, and the 
> corresponding argument is "B", so I'll rewrite that as B<int>, which I 
> know how to find".

I also agree that the actual instantiated template name is the only piece 
of information needed in the debug information. The other elements are 
probably not valuable to describe:
- default template name (i.e. template <template <class> class T> = B)
- number of template parameters in the template template parameter  (i.e. 
1 in the example given)
- name of the template parameters in the template template parameter (i.e. 
unnamed in the example given)

I think both DW_TAG_GNU_template_template_param and DW_AT_GNU_name should 
go into DWARF5.  I'll suggest renaming them to:
DW_TAG_template_template_parameter and DW_AT_instantiated_name 
respectively.

Should the name in DW_AT_instantiated_name be normalized? 
i.e.  A<std :: vector>
There could be space characters in the within the name "std::vector", is 
it necessary to enforce a 'no-space' rule in the name?

=====
As for the template parameter packs, I am in the opinion to leave it to 
the producer to decide if they want to name the parameters within the 
pack.  And consumer can add additional logic to handle the unnamed 
parameters within the pack.

Kendrick Wong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dwarfstd.org/private.cgi/dwarf-discuss-dwarfstd.org/attachments/20090828/15a2ac0e/attachment-0001.htm>


More information about the Dwarf-Discuss mailing list