[Lldb-commits] [lldb] Add the ability to pass a parent to ValueObjectMemory::Create. (PR #195155)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 30 12:01:33 PDT 2026


================
@@ -1011,6 +1011,35 @@ class ValueObject {
     ChildrenMap m_children;
     size_t m_children_count = 0;
   };
+  
+  using ValueObjectManagerSP = std::shared_ptr<ValueObjectManager>;
+  
+  /// The following two functions are helpers for Create methods
+  /// for ValueObject subclasses that need to optionally receive
+  /// a parent or external manager.
+  /// This returns a ValueObjectManagerSP that is either the SP of the
+  /// parent - if it is non-null, or a new manager if null.
+  static ValueObjectManagerSP ReuseManagerIfParent(ValueObject *parent) {
+    std::shared_ptr<ValueObjectManager> manager_sp;
+    if (parent)
+      manager_sp = parent->GetManager()->shared_from_this();
+    else
+      manager_sp = ValueObjectManager::Create();
+    return manager_sp;
----------------
JDevlieghere wrote:

```suggestion
    std::shared_ptr<ValueObjectManager> manager_sp =
        parent ? parent->GetManager()->shared_from_this()
               : ValueObjectManager::Create();
    return manager_sp;

```

https://github.com/llvm/llvm-project/pull/195155


More information about the lldb-commits mailing list