[Lldb-commits] [PATCH] D97205: [lldb][NFC] Don't inherit from UserID in ValueObject

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 23 01:14:20 PST 2021


teemperor updated this revision to Diff 325708.
teemperor added a comment.

- Rebased.
- Add a `GetID()` call where we relied on the `==` overload before.


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

https://reviews.llvm.org/D97205

Files:
  lldb/include/lldb/Core/ValueObject.h
  lldb/source/Core/ValueObject.cpp
  lldb/source/DataFormatters/TypeSynthetic.cpp


Index: lldb/source/DataFormatters/TypeSynthetic.cpp
===================================================================
--- lldb/source/DataFormatters/TypeSynthetic.cpp
+++ lldb/source/DataFormatters/TypeSynthetic.cpp
@@ -128,7 +128,7 @@
                                               ValueObject &backend)
     : SyntheticChildrenFrontEnd(backend), m_python_class(pclass),
       m_wrapper_sp(), m_interpreter(nullptr) {
-  if (backend == LLDB_INVALID_UID)
+  if (backend.GetID() == LLDB_INVALID_UID)
     return;
 
   TargetSP target_sp = backend.GetTargetSP();
Index: lldb/source/Core/ValueObject.cpp
===================================================================
--- lldb/source/Core/ValueObject.cpp
+++ lldb/source/Core/ValueObject.cpp
@@ -76,9 +76,8 @@
 
 // ValueObject constructor
 ValueObject::ValueObject(ValueObject &parent)
-    : UserID(++g_value_obj_uid), // Unique identifier for every value object
-      m_parent(&parent), m_update_point(parent.GetUpdatePoint()),
-      m_manager(parent.GetManager()) {
+    : m_parent(&parent), m_update_point(parent.GetUpdatePoint()),
+      m_manager(parent.GetManager()), m_id(++g_value_obj_uid) {
   m_flags.m_is_synthetic_children_generated =
       parent.m_flags.m_is_synthetic_children_generated;
   m_data.SetByteOrder(parent.GetDataExtractor().GetByteOrder());
@@ -90,9 +89,9 @@
 ValueObject::ValueObject(ExecutionContextScope *exe_scope,
                          ValueObjectManager &manager,
                          AddressType child_ptr_or_ref_addr_type)
-    : UserID(++g_value_obj_uid), // Unique identifier for every value object
-      m_update_point(exe_scope), m_manager(&manager),
-      m_address_type_of_ptr_or_ref_children(child_ptr_or_ref_addr_type) {
+    : m_update_point(exe_scope), m_manager(&manager),
+      m_address_type_of_ptr_or_ref_children(child_ptr_or_ref_addr_type),
+      m_id(++g_value_obj_uid) {
   if (exe_scope) {
     TargetSP target_sp(exe_scope->CalculateTarget());
     if (target_sp) {
Index: lldb/include/lldb/Core/ValueObject.h
===================================================================
--- lldb/include/lldb/Core/ValueObject.h
+++ lldb/include/lldb/Core/ValueObject.h
@@ -102,7 +102,7 @@
 /// Shared Pointer to the contained ValueObject,
 /// just do so by calling GetSP() on the contained object.
 
-class ValueObject : public UserID {
+class ValueObject {
 public:
   enum GetExpressionPathFormat {
     eGetExpressionPathFormatDereferencePointers = 1,
@@ -457,6 +457,9 @@
 
   ConstString GetName() const;
 
+  /// Returns a unique uid for this ValueObject.
+  lldb::user_id_t GetID() const { return m_id.GetID(); }
+
   virtual lldb::ValueObjectSP GetChildAtIndex(size_t idx, bool can_create);
 
   // this will always create the children if necessary
@@ -885,6 +888,9 @@
 
   uint64_t m_language_flags = 0;
 
+  /// Unique identifier for every value object.
+  UserID m_id;
+
   // Utility class for initializing all bitfields in ValueObject's constructors.
   // FIXME: This could be done via default initializers once we have C++20.
   struct Bitflags {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97205.325708.patch
Type: text/x-patch
Size: 3081 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210223/18911e77/attachment.bin>


More information about the lldb-commits mailing list