[Lldb-commits] [PATCH] D74153: [lldb] Delete the SharingPtr class

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 6 11:56:19 PST 2020


labath created this revision.
labath added reviewers: teemperor, JDevlieghere, jingham.
Herald added subscribers: jfb, mgorny.
Herald added a project: LLDB.

The only use of this class was to implement the SharedCluster of ValueObjects.
However, the same functionality can be implemented using a regular
std::shared_ptr, and its little-known "sub-object pointer" feature, where the
pointer can point to one thing, but actually delete something else when it goes
out of scope.

This patch reimplements SharedCluster using this feature --
SharedClusterPointer::GetObject now returns a std::shared_pointer which points
to the ValueObject, but actually owns the whole cluster. The only change I
needed to make here is that now the SharedCluster object needs to be created
before the root ValueObject. This means that all private ValueObject
constructors get a ClusterManager argument, and their static Create functions do
the create-a-manager-and-pass-it-to-value-object dance.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74153

Files:
  lldb/cmake/modules/LLDBFramework.cmake
  lldb/include/lldb/Core/ValueObject.h
  lldb/include/lldb/Core/ValueObjectConstResult.h
  lldb/include/lldb/Core/ValueObjectDynamicValue.h
  lldb/include/lldb/Core/ValueObjectMemory.h
  lldb/include/lldb/Core/ValueObjectRegister.h
  lldb/include/lldb/Core/ValueObjectVariable.h
  lldb/include/lldb/Utility/SharedCluster.h
  lldb/include/lldb/Utility/SharingPtr.h
  lldb/include/lldb/lldb-forward.h
  lldb/source/Core/FormatEntity.cpp
  lldb/source/Core/ValueObject.cpp
  lldb/source/Core/ValueObjectConstResult.cpp
  lldb/source/Core/ValueObjectConstResultImpl.cpp
  lldb/source/Core/ValueObjectList.cpp
  lldb/source/Core/ValueObjectMemory.cpp
  lldb/source/Core/ValueObjectRegister.cpp
  lldb/source/Core/ValueObjectSyntheticFilter.cpp
  lldb/source/Core/ValueObjectVariable.cpp
  lldb/source/Expression/IRInterpreter.cpp
  lldb/source/Utility/CMakeLists.txt
  lldb/source/Utility/SharingPtr.cpp
  lldb/unittests/Utility/SharedClusterTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74153.242972.patch
Type: text/x-patch
Size: 43235 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200206/736ac850/attachment-0001.bin>


More information about the lldb-commits mailing list