[lldb] Add deref support to libc++ unique_ptr synthetic
authorDave Lee <davelee.com@gmail.com>
Thu, 25 Feb 2021 21:27:22 +0000 (13:27 -0800)
committerDave Lee <davelee.com@gmail.com>
Fri, 26 Feb 2021 15:39:01 +0000 (07:39 -0800)
commit3a677b29a3b3f6a2539843db4d56ba59689fc0a0
tree3edd27b81d43d17bb7c0bbe0ea1f37cd764bc5d7
parent9909237d992000d651b32212d15111453485a6b0
[lldb] Add deref support to libc++ unique_ptr synthetic

Add frame variable dereference suppport to libc++ `std::unique_ptr`.

This change allows for commands like `v *thing_up` and `v thing_up->m_id`. These commands now work the same way they would with raw pointers, and as they would with expression. This is done by adding an unaccounted for child member named `$$dereference$$`.

Without this change, the command would have to be written as `v *thing_up.__value_` or v thing_up.__value_->m_id` which exposes internal structure and is more clumsy to type.

Additionally, the existing tests were updated. See also https://reviews.llvm.org/D97165 which added deref support for `std::shared_ptr`.

Differential Revision: https://reviews.llvm.org/D97524
lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxx.h
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