[llvm] [llvm-debuginfo-analyzer] Add support for DW_AT_GNU_template_name. (PR #115724)
Carlos Alberto Enciso via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 28 05:54:59 PST 2024
CarlosAlbertoEnciso wrote:
For the given test case, GCC and Clang generate the following DWARF
```
...
DW_TAG_GNU_template_template_param
DW_AT_name ("TemplateTemplateType")
DW_AT_GNU_template_name ("Bar")
...
DW_TAG_GNU_template_template_param
DW_AT_name ("TemplateType")
DW_AT_GNU_template_name ("Foo")
...
```
The `--attribute=typename` adds the `DW_AT_name` to the printed logical view.
```
clang++ -c -g -O0 template.cpp -o template-clang.o
llvm-debuginfo-analyzer --print=elements --attribute=typename template-clang.o
```
```
Logical View:
{File} 'template-clang.o'
{CompileUnit} 'template.cpp'
1 {Class} 'Foo<int>'
{TemplateType} 'T' -> 'int'
1 {Member} private 'Member' -> 'int'
4 {Class} 'Bar<Foo>'
{TemplateTemplate} 'TemplateType' -> 'Foo' <-- DW_AT_name value
5 {Member} private 'Int' -> 'Foo<int>'
9 {Class} 'Baz<Bar>'
{TemplateTemplate} 'TemplateTemplateType' -> 'Bar' <-- DW_AT_name value
10 {Member} private 'Foo' -> 'Bar<Foo>'
13 {TypeAlias} 'Example' -> 'Baz<Bar>'
14 {Variable} extern 'TT' -> 'Example'
```
https://github.com/llvm/llvm-project/pull/115724
More information about the llvm-commits
mailing list