[Lldb-commits] [PATCH] D145803: [clang][DebugInfo] Emit DW_AT_type of preferred name if available

Michael Buch via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 28 14:04:48 PDT 2023


Michael137 added a comment.

In D145803#4220124 <https://reviews.llvm.org/D145803#4220124>, @wolfgangp wrote:

> In D145803#4219894 <https://reviews.llvm.org/D145803#4219894>, @probinson wrote:
>
>> This is pretty different from the "always desugar to the canonical type" habit that has always been in place. Sony has done some downstream things to try to work around that in the past. @wolfgangp will remember it better than I do, but I think we make some effort to preserve the type-as-written. This goes in completely the other direction.
>
> The Sony solution does not rely on a user-specified attribute, but uniformly preserves all typedefs, though only in template argument types. Similar to this solution, it adds a second type to keep track of the preferred type, though it does so in the TemplateArgument structure as a separate QualType. A client can then either print the preferred type or the canonical type, depending on a printing policy, which is controlled by an option. This leads to a similar result in the resulting DWARF, i.e. the DW_AT_type node gets the preferred type string. The preferred type can also be used for diagnostic messages.

Neat, thanks for outlining your approach. IIUC, this basically just replicates the `PrintingPolicy::UsePreferredNames` when printing the names of template specializations. But it works for all typedefs, not just those annotated with the attribute.

@probinson Sounds like Sony's solution also changes the `DW_AT_type` to a non-canonical form. Do you still have concerns with the direction of this patch? Would it cause any problems for you downstream?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145803



More information about the lldb-commits mailing list