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

Wolfgang Pieb via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 24 10:39:29 PDT 2023


wolfgangp added a comment.

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.



================
Comment at: clang/lib/CodeGen/CGDebugInfo.h:289
+  /// PreferredNameAttr attribute on \ref RD refers to. If no such
+  /// attribute exists, returns nullptr.
+  llvm::DIType *GetPreferredNameType(const CXXRecordDecl *RD,
----------------
This comment seems a bit garbled. Also, this is just a helper function, no?


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