[Lldb-commits] [lldb] Add the ability to pass a parent to ValueObjectMemory::Create. (PR #195155)
via lldb-commits
lldb-commits at lists.llvm.org
Thu Apr 30 11:59:11 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- lldb/include/lldb/ValueObject/ValueObject.h lldb/include/lldb/ValueObject/ValueObjectConstResult.h lldb/include/lldb/ValueObject/ValueObjectMemory.h lldb/source/ValueObject/ValueObjectConstResult.cpp lldb/source/ValueObject/ValueObjectMemory.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/lldb/include/lldb/ValueObject/ValueObject.h b/lldb/include/lldb/ValueObject/ValueObject.h
index 6ff096cc1..d18198196 100644
--- a/lldb/include/lldb/ValueObject/ValueObject.h
+++ b/lldb/include/lldb/ValueObject/ValueObject.h
@@ -1011,9 +1011,9 @@ protected:
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.
@@ -1027,11 +1027,12 @@ protected:
manager_sp = ValueObjectManager::Create();
return manager_sp;
}
-
+
/// If manager is null, makes a new ValueObjectManager and sets
/// manager to the new ValueObjectManager. It also returns the
/// shared pointer which is necessary to keep the new manager alive.
- static ValueObjectManagerSP CreateManagerIfEmpty(ValueObjectManager *&manager) {
+ static ValueObjectManagerSP
+ CreateManagerIfEmpty(ValueObjectManager *&manager) {
std::shared_ptr<ValueObjectManager> manager_sp;
if (!manager) {
manager_sp = ValueObjectManager::Create();
@@ -1040,7 +1041,6 @@ protected:
return manager_sp;
}
-
// Classes that inherit from ValueObject can see and modify these
/// The parent value object, or nullptr if this has no parent.
@@ -1212,8 +1212,6 @@ protected:
protected:
virtual void DoUpdateChildrenAddressType(ValueObject &valobj) {};
-
-
private:
void UpdateChildrenAddressType() {
diff --git a/lldb/source/ValueObject/ValueObjectConstResult.cpp b/lldb/source/ValueObject/ValueObjectConstResult.cpp
index b1c774ba0..e6a09b748 100644
--- a/lldb/source/ValueObject/ValueObjectConstResult.cpp
+++ b/lldb/source/ValueObject/ValueObjectConstResult.cpp
@@ -31,8 +31,7 @@ ValueObjectSP ValueObjectConstResult::Create(ExecutionContextScope *exe_scope,
uint32_t addr_byte_size,
lldb::addr_t address,
ValueObjectManager *manager) {
- ValueObjectManagerSP manager_sp =
- CreateManagerIfEmpty(manager);
+ ValueObjectManagerSP manager_sp = CreateManagerIfEmpty(manager);
return (new ValueObjectConstResult(exe_scope, *manager, byte_order,
addr_byte_size, address))
diff --git a/lldb/source/ValueObject/ValueObjectMemory.cpp b/lldb/source/ValueObject/ValueObjectMemory.cpp
index 7d7a4eec9..c85b38215 100644
--- a/lldb/source/ValueObject/ValueObjectMemory.cpp
+++ b/lldb/source/ValueObject/ValueObjectMemory.cpp
@@ -34,8 +34,8 @@ ValueObjectSP ValueObjectMemory::Create(ExecutionContextScope *exe_scope,
const Address &address,
lldb::TypeSP &type_sp,
ValueObject *parent) {
-
- std::shared_ptr<ValueObjectManager> manager_sp =
+
+ std::shared_ptr<ValueObjectManager> manager_sp =
ValueObject::ReuseManagerIfParent(parent);
return (new ValueObjectMemory(exe_scope, *manager_sp, name, address, type_sp))
->GetSP();
@@ -46,7 +46,7 @@ ValueObjectSP ValueObjectMemory::Create(ExecutionContextScope *exe_scope,
const Address &address,
const CompilerType &ast_type,
ValueObject *parent) {
- std::shared_ptr<ValueObjectManager> manager_sp =
+ std::shared_ptr<ValueObjectManager> manager_sp =
ValueObject::ReuseManagerIfParent(parent);
return (new ValueObjectMemory(exe_scope, *manager_sp, name, address,
ast_type))
``````````
</details>
https://github.com/llvm/llvm-project/pull/195155
More information about the lldb-commits
mailing list