[Lldb-commits] [PATCH] D104283: [lldb] Fix libstdc++ 11's std::unique_ptr affecting LLDB testsuite TestDataFormatterStdUniquePtr.py

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 15 02:13:40 PDT 2021


teemperor accepted this revision.
teemperor added a comment.
This revision is now accepted and ready to land.

> Personally I think if there is the pointer (and sizeof(std::unique_ptr<XXX, YYY> == 16) there should be the "deleter =" specified even if it is default deleter.

I don't think that it can happen that `sizeof(ptr) == 16` with a reasonable unique_ptr/default_delete implementation, but I think in theory it could be possible.

But anyway, after some offline discussion with @jankratochvil  the consensus was:

- We should hide the deleter if it's stateless (default_delete or a user-specified deleter that is empty) as the less verbose output is more useful for command line users.
- Users that care about the (user-specified) empty deleter (or the default deleter) can always inspect the type via the template argument. That anyway has to happen via the SB API and the ValueObject doesn't provide a great benefit there.

So this patch LGTM, but please update the update comment when landing to something like:

  // Add a 'deleter' child if there was a non-empty deleter type specified.
  // 
  // The object might have size=1 in the TypeSystem but occupies no dedicated storage due
  // to no_unique_address, so infer the actual size from the total size of the unique_ptr class.
  // If sizeof(unique_ptr) == sizeof(void*) then the deleter is empty and should be hidden.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104283



More information about the lldb-commits mailing list