[llvm-bugs] [Bug 52262] New: Local typedef information is missing in case of template clas
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Oct 22 05:38:17 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=52262
Bug ID: 52262
Summary: Local typedef information is missing in case of
template clas
Product: libraries
Version: 12.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: DebugInfo
Assignee: unassignedbugs at nondot.org
Reporter: christina.schimpe at intel.com
CC: jdevlieghere at apple.com, keith.walker at arm.com,
llvm-bugs at lists.llvm.org,
paul_robinson at playstation.sony.com
If a typedef is defined inside a class, the tag DW_TAG_typedef is listed as a
child entry of that class (tag DW_TAG_class_type).
For clang the child entry relationship is lost, if the class has a template
parameter.
Steps to reproduce:
Compiling a program such as
template<typename DataT>
class Cfoo
{
typedef float myfloat;
public:
DataT me0;
const DataT me1=1;
const myfloat me2=2.0;
};
int main()
{
Cfoo<int> cfoo;
return 0;
}
yields the following DWARF output for the DW_TAG_typedef tag of "myfloat":
0x00000052: DW_TAG_class_type
DW_AT_calling_convention (DW_CC_pass_by_value)
DW_AT_name ("Cfoo<int>")
DW_AT_byte_size (0x0c)
DW_AT_decl_file ("/tmp/no_localtypdefinfo.cc")
DW_AT_decl_line (2)
0x0000005b: DW_TAG_template_type_parameter
DW_AT_type (0x00000098 "int")
DW_AT_name ("DataT")
0x00000064: DW_TAG_member
DW_AT_name ("me0")
DW_AT_type (0x00000098 "int")
DW_AT_decl_file ("/tmp/no_localtypdefinfo.cc")
DW_AT_decl_line (6)
DW_AT_data_member_location (0x00)
DW_AT_accessibility (DW_ACCESS_public)
0x00000071: DW_TAG_member
DW_AT_name ("me1")
DW_AT_type (0x0000009f "const int")
DW_AT_decl_file ("/tmp/no_localtypdefinfo.cc")
DW_AT_decl_line (7)
DW_AT_data_member_location (0x04)
DW_AT_accessibility (DW_ACCESS_public)
0x0000007e: DW_TAG_member
DW_AT_name ("me2")
DW_AT_type (0x000000a4 "const myfloat")
DW_AT_decl_file ("/tmp/no_localtypdefinfo.cc")
DW_AT_decl_line (8)
DW_AT_data_member_location (0x08)
DW_AT_accessibility (DW_ACCESS_public)
...
0x00000096: NULL
0x00000097: NULL
...
0x000000a4: DW_TAG_const_type
DW_AT_type (0x000000a9 "myfloat")
0x000000a9: DW_TAG_typedef
DW_AT_type (0x000000b4 "float")
DW_AT_name ("myfloat")
DW_AT_decl_file ("/tmp/no_localtypdefinfo.cc")
DW_AT_decl_line (4)
The tag DW_TAG_typdef is NOT a child entry of the tag DW_TAG_class_type.
Compiling a class without template parameter such as:
class Cfoo
{
typedef float myfloat;
public:
const myfloat me2=2.0;
};
int main()
{
Cfoo cfoo;
return 0;
}
yields the following DWARF output for the DW_TAG_typedef tag of "myfloat":
0x00000052: DW_TAG_class_type
DW_AT_calling_convention (DW_CC_pass_by_value)
DW_AT_name ("Cfoo")
DW_AT_byte_size (0x04)
DW_AT_decl_file ("/tmp/existing_localtypdefinfo.cc")
DW_AT_decl_line (1)
0x0000005b: DW_TAG_member
DW_AT_name ("me2")
DW_AT_type (0x00000080 "const myfloat")
DW_AT_decl_file ("/tmp/existing_localtypdefinfo.cc")
DW_AT_decl_line (5)
DW_AT_data_member_location (0x00)
DW_AT_accessibility (DW_ACCESS_public)
0x00000068: DW_TAG_typedef
DW_AT_type (0x00000085 "float")
DW_AT_name ("myfloat")
DW_AT_decl_file ("/tmp/existing_localtypdefinfo.cc")
DW_AT_decl_line (3)
The tag DW_TAG_typedef is now a child entry of the tag DW_TAG_class_type.
Command lines to build and run the case:
clang++ -g -O0 no_localtypdefinfo.cc -o no_localtypdefinfo
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211022/c814a534/attachment-0001.html>
More information about the llvm-bugs
mailing list