[PATCH] D143501: [clang][DebugInfo] lldb: Use preferred name's type when emitting DW_AT_names

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 9 11:44:46 PST 2023


dblaikie added a comment.

In D143501#4110302 <https://reviews.llvm.org/D143501#4110302>, @Michael137 wrote:

> The alternative would be attaching the preferred name as a new attribute or an existing attribute like `DW_AT_description`.

I'd recommend a possible long-term solution would be simplified template names (so we don't have to worry about encoding this in the `DW_AT_name` anyway) and a "DW_AT_LLVM_preferred_name" or similar attribute on a type that refers to the typedef that is the preferred name. This would generalize further than only appearing in template names - the type of a variable inside a template would also gain the beneficial naming (eg: `template<typename T> void f1(T t) { }` - as it stands, the type of the variable `t` must be `std::basic_string<char...` - but if the `DW_TAG_class_type` for `std::basic_string<char...` had this preferred-name attribute on it, then a debugger could helpfully render the type by its preferred alias instead)

Alternatively, I suppose, the DWARF emission could just look at the preferred name and use that as the `DW_AT_type` in all cases anyway? Avoids needing a new attribute, etc, though would be a bit quirky in its own way.

Doing this ^ would also then fix the divergence introduced by changing the naming - and would ensure simple template names still match up with names rebuilt from the DW_TAG_template_type_parameters.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143501/new/

https://reviews.llvm.org/D143501



More information about the cfe-commits mailing list