aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Core/ValueObject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Core/ValueObject.cpp')
-rw-r--r--lldb/source/Core/ValueObject.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index 6794d0c7331d..d80139ab1840 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -42,8 +42,8 @@
#include "lldb/Utility/DataBuffer.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/Flags.h"
+#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
-#include "lldb/Utility/Logging.h"
#include "lldb/Utility/Scalar.h"
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/StreamString.h"
@@ -200,7 +200,7 @@ bool ValueObject::UpdateValueIfNeeded(bool update_format) {
}
bool ValueObject::UpdateFormatsIfNeeded() {
- Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS));
+ Log *log = GetLog(LLDBLog::DataFormatters);
LLDB_LOGF(log,
"[%s %p] checking for FormatManager revisions. ValueObject "
"rev: %d - Global rev: %d",
@@ -265,7 +265,7 @@ CompilerType ValueObject::MaybeCalculateCompleteType() {
process_sp->GetLanguageRuntime(GetObjectRuntimeLanguage())) {
if (llvm::Optional<CompilerType> complete_type =
runtime->GetRuntimeType(compiler_type)) {
- m_override_type = complete_type.getValue();
+ m_override_type = *complete_type;
if (m_override_type.IsValid())
return m_override_type;
}
@@ -792,7 +792,7 @@ bool ValueObject::SetData(DataExtractor &data, Status &error) {
uint64_t count = 0;
const Encoding encoding = GetCompilerType().GetEncoding(count);
- const size_t byte_size = GetByteSize().getValueOr(0);
+ const size_t byte_size = GetByteSize().value_or(0);
Value::ValueType value_type = m_value.GetValueType();
@@ -848,18 +848,18 @@ bool ValueObject::SetData(DataExtractor &data, Status &error) {
}
static bool CopyStringDataToBufferSP(const StreamString &source,
- lldb::DataBufferSP &destination) {
+ lldb::WritableDataBufferSP &destination) {
llvm::StringRef src = source.GetString();
- src.consume_back(llvm::StringRef("\0", 1));
+ src = src.rtrim('\0');
destination = std::make_shared<DataBufferHeap>(src.size(), 0);
memcpy(destination->GetBytes(), src.data(), src.size());
return true;
}
std::pair<size_t, bool>
-ValueObject::ReadPointedString(lldb::DataBufferSP &buffer_sp, Status &error,
- uint32_t max_length, bool honor_array,
- Format item_format) {
+ValueObject::ReadPointedString(lldb::WritableDataBufferSP &buffer_sp,
+ Status &error, uint32_t max_length,
+ bool honor_array, Format item_format) {
bool was_capped = false;
StreamString s;
ExecutionContext exe_ctx(GetExecutionContextRef());
@@ -1184,7 +1184,7 @@ bool ValueObject::DumpPrintableRepresentation(
eFormatVectorOfChar)) // print char[] & char* directly
{
Status error;
- lldb::DataBufferSP buffer_sp;
+ lldb::WritableDataBufferSP buffer_sp;
std::pair<size_t, bool> read_string = ReadPointedString(
buffer_sp, error, 0, (custom_format == eFormatVectorOfChar) ||
(custom_format == eFormatCharArray));
@@ -1474,7 +1474,7 @@ bool ValueObject::SetValueFromCString(const char *value_str, Status &error) {
uint64_t count = 0;
const Encoding encoding = GetCompilerType().GetEncoding(count);
- const size_t byte_size = GetByteSize().getValueOr(0);
+ const size_t byte_size = GetByteSize().value_or(0);
Value::ValueType value_type = m_value.GetValueType();
@@ -1656,13 +1656,13 @@ ValueObjectSP ValueObject::GetSyntheticBitFieldChild(uint32_t from, uint32_t to,
uint32_t bit_field_offset = from;
if (GetDataExtractor().GetByteOrder() == eByteOrderBig)
bit_field_offset =
- GetByteSize().getValueOr(0) * 8 - bit_field_size - bit_field_offset;
+ GetByteSize().value_or(0) * 8 - bit_field_size - bit_field_offset;
// We haven't made a synthetic array member for INDEX yet, so lets make
// one and cache it for any future reference.
ValueObjectChild *synthetic_child = new ValueObjectChild(
- *this, GetCompilerType(), index_const_str,
- GetByteSize().getValueOr(0), 0, bit_field_size, bit_field_offset,
- false, false, eAddressTypeInvalid, 0);
+ *this, GetCompilerType(), index_const_str, GetByteSize().value_or(0),
+ 0, bit_field_size, bit_field_offset, false, false,
+ eAddressTypeInvalid, 0);
// Cache the value if we got one back...
if (synthetic_child) {
@@ -2803,7 +2803,7 @@ ValueObject::EvaluationPoint::EvaluationPoint() : m_mod_id(), m_exe_ctx_ref() {}
ValueObject::EvaluationPoint::EvaluationPoint(ExecutionContextScope *exe_scope,
bool use_selected)
- : m_mod_id(), m_exe_ctx_ref(), m_needs_update(true) {
+ : m_mod_id(), m_exe_ctx_ref() {
ExecutionContext exe_ctx(exe_scope);
TargetSP target_sp(exe_ctx.GetTargetSP());
if (target_sp) {
@@ -2840,7 +2840,7 @@ ValueObject::EvaluationPoint::EvaluationPoint(ExecutionContextScope *exe_scope,
ValueObject::EvaluationPoint::EvaluationPoint(
const ValueObject::EvaluationPoint &rhs)
- : m_mod_id(), m_exe_ctx_ref(rhs.m_exe_ctx_ref), m_needs_update(true) {}
+ : m_mod_id(), m_exe_ctx_ref(rhs.m_exe_ctx_ref) {}
ValueObject::EvaluationPoint::~EvaluationPoint() = default;