[Dwarf-Discuss] How to generate DWARF info for a template alias to a raw pointer

Zheng CZ Chen czhengsz@cn.ibm.com
Fri May 6 15:52:44 GMT 2022


Hi all,

Could someone help to point out what kind of DWARF info should be generated for below c++ source? Thanks

```
template<class T>
using ptr = T*;

ptr<int>  abc;
```

We declare a template alias here, so we may generate  `DW_TAG_template_type_parameter` like:

```
0x00000057:   DW_TAG_base_type
                DW_AT_name  ("int")
                DW_AT_byte_size          (0x04)
                DW_AT_encoding           (DW_ATE_signed)

0x0000005e:   DW_TAG_pointer_type
                DW_AT_type    (0x00000057 "int")

0x00000064:   DW_TAG_template_alias
                DW_AT_name  ("ptr")
                DW_AT_type    (0x0000005e "int *")

0x00000076:     DW_TAG_template_type_parameter
                  DW_AT_name               ("T")
                  DW_AT_type  (0x00000057 "int")

0x0000007e:   DW_TAG_variable
                DW_AT_name  ("abc")
                DW_AT_type    (0x00000064 "ptr<int>")
```

` DW_TAG_template_type_parameter ` should be for a notation to create a template base on another template, but as you can see the referred type 0x0000005e is not a template. What kind of DWARF info should we generate here? We should use ` DW_TAG_typedef` instead of ` DW_TAG_template_type_parameter` for this special case?

--
Thanks.

BRS//
Chen Zheng
IBM PowerPC Compiler Backend Developer

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dwarfstd.org/pipermail/dwarf-discuss-dwarfstd.org/attachments/20220506/5c048b30/attachment-0001.html>



More information about the Dwarf-discuss mailing list