[all-commits] [llvm/llvm-project] 363f05: [lldb] Delete the SharingPtr class

plabath via All-commits all-commits at lists.llvm.org
Tue Feb 11 04:24:16 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 363f05b83d9cf207e1b024ca105b8d55526178b8
      https://github.com/llvm/llvm-project/commit/363f05b83d9cf207e1b024ca105b8d55526178b8
  Author: Pavel Labath <labath at google.com>
  Date:   2020-02-11 (Tue, 11 Feb 2020)

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

  Log Message:
  -----------
  [lldb] Delete the SharingPtr class

Summary:
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.

Reviewers: teemperor, JDevlieghere, jingham

Subscribers: mgorny, jfb, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D74153




More information about the All-commits mailing list