[PATCH] D143501: [WIP][clang][DebugInfo] lldb: Use preferred name's type when emitting DW_AT_names
Michael Buch via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 7 07:49:24 PST 2023
Michael137 created this revision.
Michael137 added reviewers: aprantl, dblaikie.
Herald added a project: All.
Michael137 requested review of this revision.
Herald added projects: clang, LLDB.
Herald added subscribers: lldb-commits, cfe-commits.
**Summary**
This patch makes debug-info generation aware of the
`[[clang::preferred_name]]` attribute. The attribute tells clang
to print the annotated class template as some typedef (e.g., in
diagnostics).
When printing a typename for emission into `DW_AT_name` this patch now
uses the preferred_name (if available). This is behind an LLDB tuning
because by default we try to avoid diverging GCC and Clang typename
format (which is why the `PrintingPolicy::UsePreferredNames` has
previously been disabled by default in `CGDebugInfo`).
**Motivation**
This will reduce noise in type summaries when showing variable
types in LLDB. E.g.,:
(lldb) v
(std::vector<std::basic_string<char> >) vec = size=0 {}
becomes
(lldb) v
(std::vector<std::string>) vec = size=0 {}
**Testing**
- Added Clang test
- Adjusted LLDB API tests
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D143501
Files:
clang/lib/CodeGen/CGDebugInfo.cpp
clang/lib/CodeGen/CGDebugInfo.h
clang/test/CodeGen/debug-info-preferred-names.cpp
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/TestDataFormatterLibcxxUniquePtr.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143501.495539.patch
Type: text/x-patch
Size: 6385 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230207/6b5dcf8b/attachment-0001.bin>
More information about the cfe-commits
mailing list