[Lldb-commits] [PATCH] D148662: [lldb] Make the libcxx unique_ptr prettyprinter support custom deleters.

Jorge Gorbe Moya via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 18 14:31:50 PDT 2023


jgorbe created this revision.
jgorbe added reviewers: shafik, kastiglione.
jgorbe added a project: LLDB.
Herald added a subscriber: JDevlieghere.
Herald added a project: All.
jgorbe requested review of this revision.

The unique_ptr prettyprinter calls `GetValueOfLibCXXCompressedPair`,
which looks for a `__value_` child. However, when the second value in
the compressed pair is not an empty class, there are two `__value_`
children because `__compressed_pair` derives twice from
`__compressed_pair_elem`, one for each member of the pair. And then the
lookup fails because it's ambiguous.

This patch makes the following changes:

- Rename `GetValueOfLibCXXCompressedPair` to `GetFirstValueOfLibCXXCompressedPair`, and add a similar function to get the second value. Put both functions in Plugin/Language/CPlusPlus/LibCxx.cpp because it seems inappropriate to have libcxx-specific helpers separate from all the libcxx-dependent code.

- Read the second value of the `__ptr_` pair and display a "deleter" child in the unique_ptr synthetic child provider, when available.

- Add a test case for the non-empty deleter case.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148662

Files:
  lldb/include/lldb/DataFormatters/FormattersHelpers.h
  lldb/source/DataFormatters/FormattersHelpers.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibCxx.h
  lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
  lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/TestDataFormatterLibcxxUniquePtr.py
  lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unique_ptr/main.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148662.514739.patch
Type: text/x-patch
Size: 7968 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230418/8256950b/attachment.bin>


More information about the lldb-commits mailing list