llvm-project/lldb/source/Core/ValueObjectUpdater.cpp
Raphael Isemann 4631afdeb3 [lldb][NFC] Rename the second ValueObjectManager to ValueObjectUpdater and remove the dead code
`ValueObject.h` contains the `ValueObject::ValueObjectManager` type which is
just a typedef for the ClusterManager that takes care of the whole ValueObject
memory management. However, there is also `ValueObjectManager` defined in the
same header which is only used in the curses UI implementation and consists
mostly of dead and completely untested code.

This code been around since a while (it was added in 2016 as
8369b28da0750129ababae357bea98940800a0e0), so I think we shouldn't just revert
the whole patch.

Instead this patch just moves the class to its own header that it isn't just
hiding in the ValueObject header and renames it to `ValueObjectUpdater` that it
at least has a unique name (which I hope also slightly better reflects the
purpose of this class). I also deleted all the dead code branches and functions.

Reviewed By: #lldb, mib, JDevlieghere

Differential Revision: https://reviews.llvm.org/D97287
2021-02-24 13:58:01 +01:00

57 lines
1.7 KiB
C++

//===-- ValueObjectUpdater.cpp --------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "lldb/Core/ValueObjectUpdater.h"
using namespace lldb_private;
ValueObjectUpdater::ValueObjectUpdater(lldb::ValueObjectSP in_valobj_sp) {
if (!in_valobj_sp)
return;
// If the user passes in a value object that is dynamic or synthetic, then
// water it down to the static type.
m_root_valobj_sp = in_valobj_sp->GetQualifiedRepresentationIfAvailable(
lldb::eNoDynamicValues, false);
}
lldb::ValueObjectSP ValueObjectUpdater::GetSP() {
lldb::ProcessSP process_sp = GetProcessSP();
if (!process_sp)
return lldb::ValueObjectSP();
const uint32_t current_stop_id = process_sp->GetLastNaturalStopID();
if (current_stop_id == m_stop_id)
return m_user_valobj_sp;
m_stop_id = current_stop_id;
if (!m_root_valobj_sp) {
m_user_valobj_sp.reset();
return m_root_valobj_sp;
}
m_user_valobj_sp = m_root_valobj_sp;
lldb::ValueObjectSP dynamic_sp =
m_user_valobj_sp->GetDynamicValue(lldb::eDynamicDontRunTarget);
if (dynamic_sp)
m_user_valobj_sp = dynamic_sp;
lldb::ValueObjectSP synthetic_sp = m_user_valobj_sp->GetSyntheticValue();
if (synthetic_sp)
m_user_valobj_sp = synthetic_sp;
return m_user_valobj_sp;
}
lldb::ProcessSP ValueObjectUpdater::GetProcessSP() const {
if (m_root_valobj_sp)
return m_root_valobj_sp->GetProcessSP();
return lldb::ProcessSP();
}