With this patch, we now emit a DW_AT_LLVM_preferred_name for
the [[clang::preferred_name]] attribute attached to a class template.
This is useful for consumers in case they want to display the
name in terms of the preferred name, e.g., LLDB's type-summaries.
For now this is behind an LLDB tuning.
E.g., for following code:
template<typename T> struct Foo;
typedef Foo<int> BarInt;
typedef Foo<double> BarDouble;
template<typename T>
struct [[clang::preferred_name(BarInt),
clang::preferred_name(BarDouble)]] Foo {};...the generated DWARF with this patch looks as follows:
0x0000006b: DW_TAG_structure_type
DW_AT_LLVM_preferred_name (0x00000082)
DW_AT_name ("Foo<int>")
0x00000082: DW_TAG_typedef
DW_AT_type (0x0000006b "Foo<int>")
DW_AT_name ("BarInt")
0x0000008d: DW_TAG_structure_type
DW_AT_LLVM_preferred_name (0x000000ab)
DW_AT_name ("Foo<double>")
0x000000ab: DW_TAG_typedef
DW_AT_type (0x0000008d "Foo<double>")
DW_AT_name ("BarDouble")