[Lldb-commits] [lldb] 057efa9 - Make the error condition in Value::ValueType explicit (NFC)
Adrian Prantl via lldb-commits
lldb-commits at lists.llvm.org
Fri Feb 12 16:12:41 PST 2021
Author: Adrian Prantl
Date: 2021-02-12T16:12:31-08:00
New Revision: 057efa9916cdc354ef4653bcd128a578cc43125e
URL: https://github.com/llvm/llvm-project/commit/057efa9916cdc354ef4653bcd128a578cc43125e
DIFF: https://github.com/llvm/llvm-project/commit/057efa9916cdc354ef4653bcd128a578cc43125e.diff
LOG: Make the error condition in Value::ValueType explicit (NFC)
The comment for ValueType claims that all values <1 are errors, but
not all switch statements take this into account. This patch
introduces an explicit Error case and deletes all default: cases, so
we get warned about incomplete switch coverage.
https://reviews.llvm.org/D96537
Added:
Modified:
lldb/include/lldb/Core/Value.h
lldb/include/lldb/Expression/ExpressionVariable.h
lldb/source/Core/Value.cpp
lldb/source/Core/ValueObject.cpp
lldb/source/Core/ValueObjectChild.cpp
lldb/source/Core/ValueObjectConstResult.cpp
lldb/source/Core/ValueObjectConstResultImpl.cpp
lldb/source/Core/ValueObjectMemory.cpp
lldb/source/Core/ValueObjectRegister.cpp
lldb/source/Core/ValueObjectVariable.cpp
lldb/source/DataFormatters/TypeFormat.cpp
lldb/source/Expression/DWARFExpression.cpp
lldb/source/Expression/FunctionCaller.cpp
lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp
lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp
lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp
lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp
lldb/source/Target/ABI.cpp
lldb/source/Target/RegisterContextUnwind.cpp
lldb/source/Target/ThreadPlanTracer.cpp
lldb/unittests/Expression/DWARFExpressionTest.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/Core/Value.h b/lldb/include/lldb/Core/Value.h
index 0ff773e59911..bc0cbeae51cf 100644
--- a/lldb/include/lldb/Core/Value.h
+++ b/lldb/include/lldb/Core/Value.h
@@ -37,27 +37,32 @@ namespace lldb_private {
class Value {
public:
- // Values Less than zero are an error, greater than or equal to zero returns
- // what the Scalar result is.
- enum ValueType {
- // m_value contains...
- // ============================
- eValueTypeScalar, // raw scalar value
- eValueTypeFileAddress, // file address value
- eValueTypeLoadAddress, // load address value
- eValueTypeHostAddress // host address value (for memory in the process that
- // is using liblldb)
+ /// Type that describes Value::m_value.
+ enum class ValueType {
+ Invalid = -1,
+ // m_value contains:
+ /// A raw scalar value.
+ Scalar = 0,
+ /// A file address value.
+ FileAddress,
+ /// A load address value.
+ LoadAddress,
+ /// A host address value (for memory in the process that < A is
+ /// using liblldb).
+ HostAddress
};
- enum ContextType // Type that describes Value::m_context
- {
- // m_context contains...
- // ====================
- eContextTypeInvalid, // undefined
- eContextTypeRegisterInfo, // RegisterInfo * (can be a scalar or a vector
- // register)
- eContextTypeLLDBType, // lldb_private::Type *
- eContextTypeVariable // lldb_private::Variable *
+ /// Type that describes Value::m_context.
+ enum class ContextType {
+ // m_context contains:
+ /// Undefined.
+ Invalid = -1,
+ /// RegisterInfo * (can be a scalar or a vector register).
+ RegisterInfo = 0,
+ /// lldb_private::Type *.
+ LLDBType,
+ /// lldb_private::Variable *.
+ Variable
};
Value();
@@ -85,16 +90,16 @@ class Value {
void ClearContext() {
m_context = nullptr;
- m_context_type = eContextTypeInvalid;
+ m_context_type = ContextType::Invalid;
}
void SetContext(ContextType context_type, void *p) {
m_context_type = context_type;
m_context = p;
- if (m_context_type == eContextTypeRegisterInfo) {
+ if (m_context_type == ContextType::RegisterInfo) {
RegisterInfo *reg_info = GetRegisterInfo();
if (reg_info->encoding == lldb::eEncodingVector)
- SetValueType(eValueTypeScalar);
+ SetValueType(ValueType::Scalar);
}
}
diff --git a/lldb/include/lldb/Expression/ExpressionVariable.h b/lldb/include/lldb/Expression/ExpressionVariable.h
index 4259e6395da4..de700b676611 100644
--- a/lldb/include/lldb/Expression/ExpressionVariable.h
+++ b/lldb/include/lldb/Expression/ExpressionVariable.h
@@ -48,7 +48,7 @@ class ExpressionVariable
void SetRegisterInfo(const RegisterInfo *reg_info) {
return m_frozen_sp->GetValue().SetContext(
- Value::eContextTypeRegisterInfo, const_cast<RegisterInfo *>(reg_info));
+ Value::ContextType::RegisterInfo, const_cast<RegisterInfo *>(reg_info));
}
CompilerType GetCompilerType() { return m_frozen_sp->GetCompilerType(); }
diff --git a/lldb/source/Core/Value.cpp b/lldb/source/Core/Value.cpp
index cc8f3f4e2615..7b52ff9e4207 100644
--- a/lldb/source/Core/Value.cpp
+++ b/lldb/source/Core/Value.cpp
@@ -40,17 +40,17 @@ using namespace lldb_private;
Value::Value()
: m_value(), m_compiler_type(), m_context(nullptr),
- m_value_type(eValueTypeScalar), m_context_type(eContextTypeInvalid),
+ m_value_type(ValueType::Scalar), m_context_type(ContextType::Invalid),
m_data_buffer() {}
Value::Value(const Scalar &scalar)
: m_value(scalar), m_compiler_type(), m_context(nullptr),
- m_value_type(eValueTypeScalar), m_context_type(eContextTypeInvalid),
+ m_value_type(ValueType::Scalar), m_context_type(ContextType::Invalid),
m_data_buffer() {}
Value::Value(const void *bytes, int len)
: m_value(), m_compiler_type(), m_context(nullptr),
- m_value_type(eValueTypeHostAddress), m_context_type(eContextTypeInvalid),
+ m_value_type(ValueType::HostAddress), m_context_type(ContextType::Invalid),
m_data_buffer() {
SetBytes(bytes, len);
}
@@ -91,13 +91,13 @@ Value &Value::operator=(const Value &rhs) {
}
void Value::SetBytes(const void *bytes, int len) {
- m_value_type = eValueTypeHostAddress;
+ m_value_type = ValueType::HostAddress;
m_data_buffer.CopyData(bytes, len);
m_value = (uintptr_t)m_data_buffer.GetBytes();
}
void Value::AppendBytes(const void *bytes, int len) {
- m_value_type = eValueTypeHostAddress;
+ m_value_type = ValueType::HostAddress;
m_data_buffer.AppendData(bytes, len);
m_value = (uintptr_t)m_data_buffer.GetBytes();
}
@@ -113,26 +113,27 @@ Value::ValueType Value::GetValueType() const { return m_value_type; }
AddressType Value::GetValueAddressType() const {
switch (m_value_type) {
- case eValueTypeScalar:
+ case ValueType::Invalid:
+ case ValueType::Scalar:
break;
- case eValueTypeLoadAddress:
+ case ValueType::LoadAddress:
return eAddressTypeLoad;
- case eValueTypeFileAddress:
+ case ValueType::FileAddress:
return eAddressTypeFile;
- case eValueTypeHostAddress:
+ case ValueType::HostAddress:
return eAddressTypeHost;
}
return eAddressTypeInvalid;
}
RegisterInfo *Value::GetRegisterInfo() const {
- if (m_context_type == eContextTypeRegisterInfo)
+ if (m_context_type == ContextType::RegisterInfo)
return static_cast<RegisterInfo *>(m_context);
return nullptr;
}
Type *Value::GetType() {
- if (m_context_type == eContextTypeLLDBType)
+ if (m_context_type == ContextType::LLDBType)
return static_cast<Type *>(m_context);
return nullptr;
}
@@ -144,7 +145,9 @@ size_t Value::AppendDataToHostBuffer(const Value &rhs) {
size_t curr_size = m_data_buffer.GetByteSize();
Status error;
switch (rhs.GetValueType()) {
- case eValueTypeScalar: {
+ case ValueType::Invalid:
+ return 0;
+ case ValueType::Scalar: {
const size_t scalar_size = rhs.m_value.GetByteSize();
if (scalar_size > 0) {
const size_t new_size = curr_size + scalar_size;
@@ -156,9 +159,9 @@ size_t Value::AppendDataToHostBuffer(const Value &rhs) {
}
}
} break;
- case eValueTypeFileAddress:
- case eValueTypeLoadAddress:
- case eValueTypeHostAddress: {
+ case ValueType::FileAddress:
+ case ValueType::LoadAddress:
+ case ValueType::HostAddress: {
const uint8_t *src = rhs.GetBuffer().GetBytes();
const size_t src_len = rhs.GetBuffer().GetByteSize();
if (src && src_len > 0) {
@@ -174,7 +177,7 @@ size_t Value::AppendDataToHostBuffer(const Value &rhs) {
}
size_t Value::ResizeData(size_t len) {
- m_value_type = eValueTypeHostAddress;
+ m_value_type = ValueType::HostAddress;
m_data_buffer.SetByteSize(len);
m_value = (uintptr_t)m_data_buffer.GetBytes();
return m_data_buffer.GetByteSize();
@@ -182,12 +185,12 @@ size_t Value::ResizeData(size_t len) {
bool Value::ValueOf(ExecutionContext *exe_ctx) {
switch (m_context_type) {
- case eContextTypeInvalid:
- case eContextTypeRegisterInfo: // RegisterInfo *
- case eContextTypeLLDBType: // Type *
+ case ContextType::Invalid:
+ case ContextType::RegisterInfo: // RegisterInfo *
+ case ContextType::LLDBType: // Type *
break;
- case eContextTypeVariable: // Variable *
+ case ContextType::Variable: // Variable *
ResolveValue(exe_ctx);
return true;
}
@@ -196,7 +199,7 @@ bool Value::ValueOf(ExecutionContext *exe_ctx) {
uint64_t Value::GetValueByteSize(Status *error_ptr, ExecutionContext *exe_ctx) {
switch (m_context_type) {
- case eContextTypeRegisterInfo: // RegisterInfo *
+ case ContextType::RegisterInfo: // RegisterInfo *
if (GetRegisterInfo()) {
if (error_ptr)
error_ptr->Clear();
@@ -204,9 +207,9 @@ uint64_t Value::GetValueByteSize(Status *error_ptr, ExecutionContext *exe_ctx) {
}
break;
- case eContextTypeInvalid:
- case eContextTypeLLDBType: // Type *
- case eContextTypeVariable: // Variable *
+ case ContextType::Invalid:
+ case ContextType::LLDBType: // Type *
+ case ContextType::Variable: // Variable *
{
auto *scope = exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr;
if (llvm::Optional<uint64_t> size = GetCompilerType().GetByteSize(scope)) {
@@ -225,19 +228,19 @@ uint64_t Value::GetValueByteSize(Status *error_ptr, ExecutionContext *exe_ctx) {
const CompilerType &Value::GetCompilerType() {
if (!m_compiler_type.IsValid()) {
switch (m_context_type) {
- case eContextTypeInvalid:
+ case ContextType::Invalid:
break;
- case eContextTypeRegisterInfo:
+ case ContextType::RegisterInfo:
break; // TODO: Eventually convert into a compiler type?
- case eContextTypeLLDBType: {
+ case ContextType::LLDBType: {
Type *lldb_type = GetType();
if (lldb_type)
m_compiler_type = lldb_type->GetForwardCompilerType();
} break;
- case eContextTypeVariable: {
+ case ContextType::Variable: {
Variable *variable = GetVariable();
if (variable) {
Type *variable_type = variable->GetType();
@@ -257,14 +260,14 @@ void Value::SetCompilerType(const CompilerType &compiler_type) {
lldb::Format Value::GetValueDefaultFormat() {
switch (m_context_type) {
- case eContextTypeRegisterInfo:
+ case ContextType::RegisterInfo:
if (GetRegisterInfo())
return GetRegisterInfo()->format;
break;
- case eContextTypeInvalid:
- case eContextTypeLLDBType:
- case eContextTypeVariable: {
+ case ContextType::Invalid:
+ case ContextType::LLDBType:
+ case ContextType::Variable: {
const CompilerType &ast_type = GetCompilerType();
if (ast_type.IsValid())
return ast_type.GetFormat();
@@ -277,14 +280,16 @@ lldb::Format Value::GetValueDefaultFormat() {
bool Value::GetData(DataExtractor &data) {
switch (m_value_type) {
- case eValueTypeScalar:
+ case ValueType::Invalid:
+ return false;
+ case ValueType::Scalar:
if (m_value.GetData(data))
return true;
break;
- case eValueTypeLoadAddress:
- case eValueTypeFileAddress:
- case eValueTypeHostAddress:
+ case ValueType::LoadAddress:
+ case ValueType::FileAddress:
+ case ValueType::HostAddress:
if (m_data_buffer.GetByteSize()) {
data.SetData(m_data_buffer.GetBytes(), m_data_buffer.GetByteSize(),
data.GetByteOrder());
@@ -312,7 +317,10 @@ Status Value::GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data,
return error;
switch (m_value_type) {
- case eValueTypeScalar: {
+ case ValueType::Invalid:
+ error.SetErrorString("invalid value");
+ break;
+ case ValueType::Scalar: {
data.SetByteOrder(endian::InlHostByteOrder());
if (ast_type.IsValid())
data.SetAddressByteSize(ast_type.GetPointerByteSize());
@@ -332,7 +340,7 @@ Status Value::GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data,
error.SetErrorString("extracting data from value failed");
break;
}
- case eValueTypeLoadAddress:
+ case ValueType::LoadAddress:
if (exe_ctx == nullptr) {
error.SetErrorString("can't read load address (no execution context)");
} else {
@@ -369,7 +377,7 @@ Status Value::GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data,
}
break;
- case eValueTypeFileAddress:
+ case ValueType::FileAddress:
if (exe_ctx == nullptr) {
error.SetErrorString("can't read file address (no execution context)");
} else if (exe_ctx->GetTargetPtr() == nullptr) {
@@ -459,7 +467,7 @@ Status Value::GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data,
}
break;
- case eValueTypeHostAddress:
+ case ValueType::HostAddress:
address = m_value.ULongLong(LLDB_INVALID_ADDRESS);
address_type = eAddressTypeHost;
if (exe_ctx) {
@@ -564,12 +572,13 @@ Scalar &Value::ResolveValue(ExecutionContext *exe_ctx) {
const CompilerType &compiler_type = GetCompilerType();
if (compiler_type.IsValid()) {
switch (m_value_type) {
- case eValueTypeScalar: // raw scalar value
+ case ValueType::Invalid:
+ case ValueType::Scalar: // raw scalar value
break;
- case eValueTypeFileAddress:
- case eValueTypeLoadAddress: // load address value
- case eValueTypeHostAddress: // host address value (for memory in the process
+ case ValueType::FileAddress:
+ case ValueType::LoadAddress: // load address value
+ case ValueType::HostAddress: // host address value (for memory in the process
// that is using liblldb)
{
DataExtractor data;
@@ -581,17 +590,17 @@ Scalar &Value::ResolveValue(ExecutionContext *exe_ctx) {
data, 0, data.GetByteSize(), scalar,
exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr)) {
m_value = scalar;
- m_value_type = eValueTypeScalar;
+ m_value_type = ValueType::Scalar;
} else {
if ((uintptr_t)addr != (uintptr_t)m_data_buffer.GetBytes()) {
m_value.Clear();
- m_value_type = eValueTypeScalar;
+ m_value_type = ValueType::Scalar;
}
}
} else {
if ((uintptr_t)addr != (uintptr_t)m_data_buffer.GetBytes()) {
m_value.Clear();
- m_value_type = eValueTypeScalar;
+ m_value_type = ValueType::Scalar;
}
}
} break;
@@ -601,7 +610,7 @@ Scalar &Value::ResolveValue(ExecutionContext *exe_ctx) {
}
Variable *Value::GetVariable() {
- if (m_context_type == eContextTypeVariable)
+ if (m_context_type == ContextType::Variable)
return static_cast<Variable *>(m_context);
return nullptr;
}
@@ -609,42 +618,44 @@ Variable *Value::GetVariable() {
void Value::Clear() {
m_value.Clear();
m_compiler_type.Clear();
- m_value_type = eValueTypeScalar;
+ m_value_type = ValueType::Scalar;
m_context = nullptr;
- m_context_type = eContextTypeInvalid;
+ m_context_type = ContextType::Invalid;
m_data_buffer.Clear();
}
const char *Value::GetValueTypeAsCString(ValueType value_type) {
switch (value_type) {
- case eValueTypeScalar:
+ case ValueType::Invalid:
+ return "invalid";
+ case ValueType::Scalar:
return "scalar";
- case eValueTypeFileAddress:
+ case ValueType::FileAddress:
return "file address";
- case eValueTypeLoadAddress:
+ case ValueType::LoadAddress:
return "load address";
- case eValueTypeHostAddress:
+ case ValueType::HostAddress:
return "host address";
};
- return "???";
+ llvm_unreachable("enum cases exhausted.");
}
const char *Value::GetContextTypeAsCString(ContextType context_type) {
switch (context_type) {
- case eContextTypeInvalid:
+ case ContextType::Invalid:
return "invalid";
- case eContextTypeRegisterInfo:
+ case ContextType::RegisterInfo:
return "RegisterInfo *";
- case eContextTypeLLDBType:
+ case ContextType::LLDBType:
return "Type *";
- case eContextTypeVariable:
+ case ContextType::Variable:
return "Variable *";
};
- return "???";
+ llvm_unreachable("enum cases exhausted.");
}
void Value::ConvertToLoadAddress(Module *module, Target *target) {
- if (!module || !target || (GetValueType() != eValueTypeFileAddress))
+ if (!module || !target || (GetValueType() != ValueType::FileAddress))
return;
lldb::addr_t file_addr = GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
@@ -658,7 +669,7 @@ void Value::ConvertToLoadAddress(Module *module, Target *target) {
if (load_addr == LLDB_INVALID_ADDRESS)
return;
- SetValueType(Value::eValueTypeLoadAddress);
+ SetValueType(Value::ValueType::LoadAddress);
GetScalar() = load_addr;
}
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index da90092336d6..93fb5009f95b 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -336,8 +336,11 @@ const char *ValueObject::GetLocationAsCStringImpl(const Value &value,
Value::ValueType value_type = value.GetValueType();
switch (value_type) {
- case Value::eValueTypeScalar:
- if (value.GetContextType() == Value::eContextTypeRegisterInfo) {
+ case Value::ValueType::Invalid:
+ m_location_str = "invalid";
+ break;
+ case Value::ValueType::Scalar:
+ if (value.GetContextType() == Value::ContextType::RegisterInfo) {
RegisterInfo *reg_info = value.GetRegisterInfo();
if (reg_info) {
if (reg_info->name)
@@ -354,9 +357,9 @@ const char *ValueObject::GetLocationAsCStringImpl(const Value &value,
m_location_str = "scalar";
break;
- case Value::eValueTypeLoadAddress:
- case Value::eValueTypeFileAddress:
- case Value::eValueTypeHostAddress: {
+ case Value::ValueType::LoadAddress:
+ case Value::ValueType::FileAddress:
+ case Value::ValueType::HostAddress: {
uint32_t addr_nibble_size = data.GetAddressByteSize() * 2;
sstr.Printf("0x%*.*llx", addr_nibble_size, addr_nibble_size,
value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS));
@@ -852,7 +855,10 @@ bool ValueObject::SetData(DataExtractor &data, Status &error) {
Value::ValueType value_type = m_value.GetValueType();
switch (value_type) {
- case Value::eValueTypeScalar: {
+ case Value::ValueType::Invalid:
+ error.SetErrorString("invalid location");
+ return false;
+ case Value::ValueType::Scalar: {
Status set_error =
m_value.GetScalar().SetValueFromData(data, encoding, byte_size);
@@ -862,7 +868,7 @@ bool ValueObject::SetData(DataExtractor &data, Status &error) {
return false;
}
} break;
- case Value::eValueTypeLoadAddress: {
+ case Value::ValueType::LoadAddress: {
// If it is a load address, then the scalar value is the storage location
// of the data, and we have to shove this value down to that load location.
ExecutionContext exe_ctx(GetExecutionContextRef());
@@ -879,7 +885,7 @@ bool ValueObject::SetData(DataExtractor &data, Status &error) {
}
}
} break;
- case Value::eValueTypeHostAddress: {
+ case Value::ValueType::HostAddress: {
// If it is a host address, then we stuff the scalar as a DataBuffer into
// the Value's data.
DataBufferSP buffer_sp(new DataBufferHeap(byte_size, 0));
@@ -889,7 +895,7 @@ bool ValueObject::SetData(DataExtractor &data, Status &error) {
byte_size, m_data.GetByteOrder());
m_value.GetScalar() = (uintptr_t)m_data.GetDataStart();
} break;
- case Value::eValueTypeFileAddress:
+ case Value::ValueType::FileAddress:
break;
}
@@ -1107,7 +1113,7 @@ const char *ValueObject::GetValueAsCString() {
if (m_is_bitfield_for_scalar)
my_format = eFormatUnsigned;
else {
- if (m_value.GetContextType() == Value::eContextTypeRegisterInfo) {
+ if (m_value.GetContextType() == Value::ContextType::RegisterInfo) {
const RegisterInfo *reg_info = m_value.GetRegisterInfo();
if (reg_info)
my_format = reg_info->format;
@@ -1455,7 +1461,9 @@ addr_t ValueObject::GetAddressOf(bool scalar_is_load_address,
return LLDB_INVALID_ADDRESS;
switch (m_value.GetValueType()) {
- case Value::eValueTypeScalar:
+ case Value::ValueType::Invalid:
+ return LLDB_INVALID_ADDRESS;
+ case Value::ValueType::Scalar:
if (scalar_is_load_address) {
if (address_type)
*address_type = eAddressTypeLoad;
@@ -1463,13 +1471,13 @@ addr_t ValueObject::GetAddressOf(bool scalar_is_load_address,
}
break;
- case Value::eValueTypeLoadAddress:
- case Value::eValueTypeFileAddress: {
+ case Value::ValueType::LoadAddress:
+ case Value::ValueType::FileAddress: {
if (address_type)
*address_type = m_value.GetValueAddressType();
return m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
} break;
- case Value::eValueTypeHostAddress: {
+ case Value::ValueType::HostAddress: {
if (address_type)
*address_type = m_value.GetValueAddressType();
return LLDB_INVALID_ADDRESS;
@@ -1489,13 +1497,15 @@ addr_t ValueObject::GetPointerValue(AddressType *address_type) {
return address;
switch (m_value.GetValueType()) {
- case Value::eValueTypeScalar:
+ case Value::ValueType::Invalid:
+ return LLDB_INVALID_ADDRESS;
+ case Value::ValueType::Scalar:
address = m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
break;
- case Value::eValueTypeHostAddress:
- case Value::eValueTypeLoadAddress:
- case Value::eValueTypeFileAddress: {
+ case Value::ValueType::HostAddress:
+ case Value::ValueType::LoadAddress:
+ case Value::ValueType::FileAddress: {
lldb::offset_t data_offset = 0;
address = m_data.GetAddress(&data_offset);
} break;
@@ -1523,7 +1533,7 @@ bool ValueObject::SetValueFromCString(const char *value_str, Status &error) {
Value::ValueType value_type = m_value.GetValueType();
- if (value_type == Value::eValueTypeScalar) {
+ if (value_type == Value::ValueType::Scalar) {
// If the value is already a scalar, then let the scalar change itself:
m_value.GetScalar().SetValueFromCString(value_str, encoding, byte_size);
} else if (byte_size <= 16) {
@@ -1534,7 +1544,7 @@ bool ValueObject::SetValueFromCString(const char *value_str, Status &error) {
error = new_scalar.SetValueFromCString(value_str, encoding, byte_size);
if (error.Success()) {
switch (value_type) {
- case Value::eValueTypeLoadAddress: {
+ case Value::ValueType::LoadAddress: {
// If it is a load address, then the scalar value is the storage
// location of the data, and we have to shove this value down to that
// load location.
@@ -1553,7 +1563,7 @@ bool ValueObject::SetValueFromCString(const char *value_str, Status &error) {
}
}
} break;
- case Value::eValueTypeHostAddress: {
+ case Value::ValueType::HostAddress: {
// If it is a host address, then we stuff the scalar as a DataBuffer
// into the Value's data.
DataExtractor new_data;
@@ -1570,8 +1580,11 @@ bool ValueObject::SetValueFromCString(const char *value_str, Status &error) {
m_value.GetScalar() = (uintptr_t)m_data.GetDataStart();
} break;
- case Value::eValueTypeFileAddress:
- case Value::eValueTypeScalar:
+ case Value::ValueType::Invalid:
+ error.SetErrorString("invalid location");
+ return false;
+ case Value::ValueType::FileAddress:
+ case Value::ValueType::Scalar:
break;
}
} else {
@@ -1980,7 +1993,7 @@ void ValueObject::GetExpressionPath(Stream &s,
if (m_is_synthetic_children_generated) {
UpdateValueIfNeeded();
- if (m_value.GetValueType() == Value::eValueTypeLoadAddress) {
+ if (m_value.GetValueType() == Value::ValueType::LoadAddress) {
if (IsPointerOrReferenceType()) {
s.Printf("((%s)0x%" PRIx64 ")", GetTypeName().AsCString("void"),
GetValueAsUnsigned(0));
@@ -3093,7 +3106,7 @@ lldb::ValueObjectSP ValueObject::CreateValueObjectFromAddress(
exe_ctx.GetAddressByteSize()));
if (ptr_result_valobj_sp) {
ptr_result_valobj_sp->GetValue().SetValueType(
- Value::eValueTypeLoadAddress);
+ Value::ValueType::LoadAddress);
Status err;
ptr_result_valobj_sp = ptr_result_valobj_sp->Dereference(err);
if (ptr_result_valobj_sp && !name.empty())
diff --git a/lldb/source/Core/ValueObjectChild.cpp b/lldb/source/Core/ValueObjectChild.cpp
index 34baa19f0a24..60d1b2e8a841 100644
--- a/lldb/source/Core/ValueObjectChild.cpp
+++ b/lldb/source/Core/ValueObjectChild.cpp
@@ -125,28 +125,30 @@ bool ValueObjectChild::UpdateValue() {
case eAddressTypeFile: {
lldb::ProcessSP process_sp(GetProcessSP());
if (process_sp && process_sp->IsAlive())
- m_value.SetValueType(Value::eValueTypeLoadAddress);
+ m_value.SetValueType(Value::ValueType::LoadAddress);
else
- m_value.SetValueType(Value::eValueTypeFileAddress);
+ m_value.SetValueType(Value::ValueType::FileAddress);
} break;
case eAddressTypeLoad:
m_value.SetValueType(is_instance_ptr_base
- ? Value::eValueTypeScalar
- : Value::eValueTypeLoadAddress);
+ ? Value::ValueType::Scalar
+ : Value::ValueType::LoadAddress);
break;
case eAddressTypeHost:
- m_value.SetValueType(Value::eValueTypeHostAddress);
+ m_value.SetValueType(Value::ValueType::HostAddress);
break;
case eAddressTypeInvalid:
// TODO: does this make sense?
- m_value.SetValueType(Value::eValueTypeScalar);
+ m_value.SetValueType(Value::ValueType::Scalar);
break;
}
}
switch (m_value.GetValueType()) {
- case Value::eValueTypeLoadAddress:
- case Value::eValueTypeFileAddress:
- case Value::eValueTypeHostAddress: {
+ case Value::ValueType::Invalid:
+ break;
+ case Value::ValueType::LoadAddress:
+ case Value::ValueType::FileAddress:
+ case Value::ValueType::HostAddress: {
lldb::addr_t addr = m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
if (addr == LLDB_INVALID_ADDRESS) {
m_error.SetErrorString("parent address is invalid.");
@@ -182,7 +184,7 @@ bool ValueObjectChild::UpdateValue() {
}
} break;
- case Value::eValueTypeScalar:
+ case Value::ValueType::Scalar:
// try to extract the child value from the parent's scalar value
{
Scalar scalar(m_value.GetScalar());
diff --git a/lldb/source/Core/ValueObjectConstResult.cpp b/lldb/source/Core/ValueObjectConstResult.cpp
index ceb4491f8666..a32e533245b4 100644
--- a/lldb/source/Core/ValueObjectConstResult.cpp
+++ b/lldb/source/Core/ValueObjectConstResult.cpp
@@ -73,7 +73,7 @@ ValueObjectConstResult::ValueObjectConstResult(
}
m_value.GetScalar() = (uintptr_t)m_data.GetDataStart();
- m_value.SetValueType(Value::eValueTypeHostAddress);
+ m_value.SetValueType(Value::ValueType::HostAddress);
m_value.SetCompilerType(compiler_type);
m_name = name;
SetIsConstant();
@@ -115,7 +115,7 @@ ValueObjectConstResult::ValueObjectConstResult(
m_data.SetAddressByteSize(data_addr_size);
m_data.SetData(data_sp);
m_value.GetScalar() = (uintptr_t)data_sp->GetBytes();
- m_value.SetValueType(Value::eValueTypeHostAddress);
+ m_value.SetValueType(Value::ValueType::HostAddress);
m_value.SetCompilerType(compiler_type);
m_name = name;
SetIsConstant();
@@ -145,19 +145,19 @@ ValueObjectConstResult::ValueObjectConstResult(
m_value.GetScalar() = address;
m_data.SetAddressByteSize(addr_byte_size);
m_value.GetScalar().GetData(m_data, addr_byte_size);
- // m_value.SetValueType(Value::eValueTypeHostAddress);
+ // m_value.SetValueType(Value::ValueType::HostAddress);
switch (address_type) {
case eAddressTypeInvalid:
- m_value.SetValueType(Value::eValueTypeScalar);
+ m_value.SetValueType(Value::ValueType::Scalar);
break;
case eAddressTypeFile:
- m_value.SetValueType(Value::eValueTypeFileAddress);
+ m_value.SetValueType(Value::ValueType::FileAddress);
break;
case eAddressTypeLoad:
- m_value.SetValueType(Value::eValueTypeLoadAddress);
+ m_value.SetValueType(Value::ValueType::LoadAddress);
break;
case eAddressTypeHost:
- m_value.SetValueType(Value::eValueTypeHostAddress);
+ m_value.SetValueType(Value::ValueType::HostAddress);
break;
}
m_value.SetCompilerType(compiler_type);
diff --git a/lldb/source/Core/ValueObjectConstResultImpl.cpp b/lldb/source/Core/ValueObjectConstResultImpl.cpp
index e4cbbec849ec..980cea049f6f 100644
--- a/lldb/source/Core/ValueObjectConstResultImpl.cpp
+++ b/lldb/source/Core/ValueObjectConstResultImpl.cpp
@@ -132,7 +132,7 @@ lldb::ValueObjectSP ValueObjectConstResultImpl::AddressOf(Status &error) {
ConstString(new_name.c_str()), buffer, endian::InlHostByteOrder(),
exe_ctx.GetAddressByteSize());
- m_address_of_backend->GetValue().SetValueType(Value::eValueTypeScalar);
+ m_address_of_backend->GetValue().SetValueType(Value::ValueType::Scalar);
m_address_of_backend->GetValue().GetScalar() = m_live_address;
return m_address_of_backend;
diff --git a/lldb/source/Core/ValueObjectMemory.cpp b/lldb/source/Core/ValueObjectMemory.cpp
index abf7b38ed89a..e3f9668b49cf 100644
--- a/lldb/source/Core/ValueObjectMemory.cpp
+++ b/lldb/source/Core/ValueObjectMemory.cpp
@@ -57,20 +57,20 @@ ValueObjectMemory::ValueObjectMemory(ExecutionContextScope *exe_scope,
// Do not attempt to construct one of these objects with no variable!
assert(m_type_sp.get() != nullptr);
SetName(ConstString(name));
- m_value.SetContext(Value::eContextTypeLLDBType, m_type_sp.get());
+ m_value.SetContext(Value::ContextType::LLDBType, m_type_sp.get());
TargetSP target_sp(GetTargetSP());
lldb::addr_t load_address = m_address.GetLoadAddress(target_sp.get());
if (load_address != LLDB_INVALID_ADDRESS) {
- m_value.SetValueType(Value::eValueTypeLoadAddress);
+ m_value.SetValueType(Value::ValueType::LoadAddress);
m_value.GetScalar() = load_address;
} else {
lldb::addr_t file_address = m_address.GetFileAddress();
if (file_address != LLDB_INVALID_ADDRESS) {
- m_value.SetValueType(Value::eValueTypeFileAddress);
+ m_value.SetValueType(Value::ValueType::FileAddress);
m_value.GetScalar() = file_address;
} else {
m_value.GetScalar() = m_address.GetOffset();
- m_value.SetValueType(Value::eValueTypeScalar);
+ m_value.SetValueType(Value::ValueType::Scalar);
}
}
}
@@ -92,16 +92,16 @@ ValueObjectMemory::ValueObjectMemory(ExecutionContextScope *exe_scope,
m_value.SetCompilerType(m_compiler_type);
lldb::addr_t load_address = m_address.GetLoadAddress(target_sp.get());
if (load_address != LLDB_INVALID_ADDRESS) {
- m_value.SetValueType(Value::eValueTypeLoadAddress);
+ m_value.SetValueType(Value::ValueType::LoadAddress);
m_value.GetScalar() = load_address;
} else {
lldb::addr_t file_address = m_address.GetFileAddress();
if (file_address != LLDB_INVALID_ADDRESS) {
- m_value.SetValueType(Value::eValueTypeFileAddress);
+ m_value.SetValueType(Value::ValueType::FileAddress);
m_value.GetScalar() = file_address;
} else {
m_value.GetScalar() = m_address.GetOffset();
- m_value.SetValueType(Value::eValueTypeScalar);
+ m_value.SetValueType(Value::ValueType::Scalar);
}
}
}
@@ -168,15 +168,18 @@ bool ValueObjectMemory::UpdateValue() {
Value::ValueType value_type = m_value.GetValueType();
switch (value_type) {
- case Value::eValueTypeScalar:
+ case Value::ValueType::Invalid:
+ m_error.SetErrorString("Invalid value");
+ return false;
+ case Value::ValueType::Scalar:
// The variable value is in the Scalar value inside the m_value. We can
// point our m_data right to it.
m_error = m_value.GetValueAsData(&exe_ctx, m_data, GetModule().get());
break;
- case Value::eValueTypeFileAddress:
- case Value::eValueTypeLoadAddress:
- case Value::eValueTypeHostAddress:
+ case Value::ValueType::FileAddress:
+ case Value::ValueType::LoadAddress:
+ case Value::ValueType::HostAddress:
// The DWARF expression result was an address in the inferior process. If
// this variable is an aggregate type, we just need the address as the
// main value as all child variable objects will rely upon this location
@@ -185,11 +188,11 @@ bool ValueObjectMemory::UpdateValue() {
// sure this type has a value before we try and read it
// If we have a file address, convert it to a load address if we can.
- if (value_type == Value::eValueTypeFileAddress &&
+ if (value_type == Value::ValueType::FileAddress &&
exe_ctx.GetProcessPtr()) {
lldb::addr_t load_addr = m_address.GetLoadAddress(target);
if (load_addr != LLDB_INVALID_ADDRESS) {
- m_value.SetValueType(Value::eValueTypeLoadAddress);
+ m_value.SetValueType(Value::ValueType::LoadAddress);
m_value.GetScalar() = load_addr;
}
}
@@ -205,7 +208,7 @@ bool ValueObjectMemory::UpdateValue() {
// extract read its value into m_data appropriately
Value value(m_value);
if (m_type_sp)
- value.SetContext(Value::eContextTypeLLDBType, m_type_sp.get());
+ value.SetContext(Value::ContextType::LLDBType, m_type_sp.get());
else {
value.SetCompilerType(m_compiler_type);
}
diff --git a/lldb/source/Core/ValueObjectRegister.cpp b/lldb/source/Core/ValueObjectRegister.cpp
index 27461e9cebc4..1abba1a9aa62 100644
--- a/lldb/source/Core/ValueObjectRegister.cpp
+++ b/lldb/source/Core/ValueObjectRegister.cpp
@@ -249,9 +249,9 @@ bool ValueObjectRegister::UpdateValue() {
Process *process = exe_ctx.GetProcessPtr();
if (process)
m_data.SetAddressByteSize(process->GetAddressByteSize());
- m_value.SetContext(Value::eContextTypeRegisterInfo,
+ m_value.SetContext(Value::ContextType::RegisterInfo,
(void *)&m_reg_info);
- m_value.SetValueType(Value::eValueTypeHostAddress);
+ m_value.SetValueType(Value::ValueType::HostAddress);
m_value.GetScalar() = (uintptr_t)m_data.GetDataStart();
SetValueIsValid(true);
SetValueDidChange(!(m_old_reg_value == m_reg_value));
diff --git a/lldb/source/Core/ValueObjectVariable.cpp b/lldb/source/Core/ValueObjectVariable.cpp
index 5acb23aaac5b..ffb584597f77 100644
--- a/lldb/source/Core/ValueObjectVariable.cpp
+++ b/lldb/source/Core/ValueObjectVariable.cpp
@@ -135,12 +135,12 @@ bool ValueObjectVariable::UpdateValue() {
if (expr.GetExpressionData(m_data)) {
if (m_data.GetDataStart() && m_data.GetByteSize())
m_value.SetBytes(m_data.GetDataStart(), m_data.GetByteSize());
- m_value.SetContext(Value::eContextTypeVariable, variable);
+ m_value.SetContext(Value::ContextType::Variable, variable);
}
else
m_error.SetErrorString("empty constant data");
// constant bytes can't be edited - sorry
- m_resolved_value.SetContext(Value::eContextTypeInvalid, nullptr);
+ m_resolved_value.SetContext(Value::ContextType::Invalid, nullptr);
} else {
lldb::addr_t loclist_base_load_addr = LLDB_INVALID_ADDRESS;
ExecutionContext exe_ctx(GetExecutionContextRef());
@@ -163,7 +163,7 @@ bool ValueObjectVariable::UpdateValue() {
if (expr.Evaluate(&exe_ctx, nullptr, loclist_base_load_addr, nullptr,
nullptr, m_value, &m_error)) {
m_resolved_value = m_value;
- m_value.SetContext(Value::eContextTypeVariable, variable);
+ m_value.SetContext(Value::ContextType::Variable, variable);
CompilerType compiler_type = GetCompilerType();
if (compiler_type.IsValid())
@@ -183,7 +183,7 @@ bool ValueObjectVariable::UpdateValue() {
//
// FIXME: When we grow m_value, we should represent the added bits as
// undefined somehow instead of as 0's.
- if (value_type == Value::eValueTypeHostAddress &&
+ if (value_type == Value::ValueType::HostAddress &&
compiler_type.IsValid()) {
if (size_t value_buf_size = m_value.GetBuffer().GetByteSize()) {
size_t value_size = m_value.GetValueByteSize(&m_error, &exe_ctx);
@@ -196,16 +196,19 @@ bool ValueObjectVariable::UpdateValue() {
const bool process_is_alive = process && process->IsAlive();
switch (value_type) {
- case Value::eValueTypeScalar:
+ case Value::ValueType::Invalid:
+ m_error.SetErrorString("invalid value");
+ break;
+ case Value::ValueType::Scalar:
// The variable value is in the Scalar value inside the m_value. We can
// point our m_data right to it.
m_error =
m_value.GetValueAsData(&exe_ctx, m_data, GetModule().get());
break;
- case Value::eValueTypeFileAddress:
- case Value::eValueTypeLoadAddress:
- case Value::eValueTypeHostAddress:
+ case Value::ValueType::FileAddress:
+ case Value::ValueType::LoadAddress:
+ case Value::ValueType::HostAddress:
// The DWARF expression result was an address in the inferior process.
// If this variable is an aggregate type, we just need the address as
// the main value as all child variable objects will rely upon this
@@ -214,7 +217,7 @@ bool ValueObjectVariable::UpdateValue() {
// m_data. Make sure this type has a value before we try and read it
// If we have a file address, convert it to a load address if we can.
- if (value_type == Value::eValueTypeFileAddress && process_is_alive)
+ if (value_type == Value::ValueType::FileAddress && process_is_alive)
m_value.ConvertToLoadAddress(GetModule().get(), target);
if (!CanProvideValue()) {
@@ -227,7 +230,7 @@ bool ValueObjectVariable::UpdateValue() {
// Copy the Value and set the context to use our Variable so it can
// extract read its value into m_data appropriately
Value value(m_value);
- value.SetContext(Value::eContextTypeVariable, variable);
+ value.SetContext(Value::ContextType::Variable, variable);
m_error =
value.GetValueAsData(&exe_ctx, m_data, GetModule().get());
@@ -240,7 +243,7 @@ bool ValueObjectVariable::UpdateValue() {
SetValueIsValid(m_error.Success());
} else {
// could not find location, won't allow editing
- m_resolved_value.SetContext(Value::eContextTypeInvalid, nullptr);
+ m_resolved_value.SetContext(Value::ContextType::Invalid, nullptr);
}
}
@@ -257,7 +260,9 @@ void ValueObjectVariable::DoUpdateChildrenAddressType(ValueObject &valobj) {
(type_info & (lldb::eTypeIsPointer | lldb::eTypeIsReference)) != 0;
switch (value_type) {
- case Value::eValueTypeFileAddress:
+ case Value::ValueType::Invalid:
+ break;
+ case Value::ValueType::FileAddress:
// If this type is a pointer, then its children will be considered load
// addresses if the pointer or reference is dereferenced, but only if
// the process is alive.
@@ -280,7 +285,7 @@ void ValueObjectVariable::DoUpdateChildrenAddressType(ValueObject &valobj) {
else
valobj.SetAddressTypeOfChildren(eAddressTypeFile);
break;
- case Value::eValueTypeHostAddress:
+ case Value::ValueType::HostAddress:
// Same as above for load addresses, except children of pointer or refs
// are always load addresses. Host addresses are used to store freeze
// dried variables. If this type is a struct, the entire struct
@@ -291,8 +296,8 @@ void ValueObjectVariable::DoUpdateChildrenAddressType(ValueObject &valobj) {
else
valobj.SetAddressTypeOfChildren(eAddressTypeHost);
break;
- case Value::eValueTypeLoadAddress:
- case Value::eValueTypeScalar:
+ case Value::ValueType::LoadAddress:
+ case Value::ValueType::Scalar:
valobj.SetAddressTypeOfChildren(eAddressTypeLoad);
break;
}
@@ -343,7 +348,7 @@ bool ValueObjectVariable::GetDeclaration(Declaration &decl) {
}
const char *ValueObjectVariable::GetLocationAsCString() {
- if (m_resolved_value.GetContextType() == Value::eContextTypeRegisterInfo)
+ if (m_resolved_value.GetContextType() == Value::ContextType::RegisterInfo)
return GetLocationAsCStringImpl(m_resolved_value, m_data);
else
return ValueObject::GetLocationAsCString();
@@ -356,7 +361,7 @@ bool ValueObjectVariable::SetValueFromCString(const char *value_str,
return false;
}
- if (m_resolved_value.GetContextType() == Value::eContextTypeRegisterInfo) {
+ if (m_resolved_value.GetContextType() == Value::ContextType::RegisterInfo) {
RegisterInfo *reg_info = m_resolved_value.GetRegisterInfo();
ExecutionContext exe_ctx(GetExecutionContextRef());
RegisterContext *reg_ctx = exe_ctx.GetRegisterContext();
@@ -385,7 +390,7 @@ bool ValueObjectVariable::SetData(DataExtractor &data, Status &error) {
return false;
}
- if (m_resolved_value.GetContextType() == Value::eContextTypeRegisterInfo) {
+ if (m_resolved_value.GetContextType() == Value::ContextType::RegisterInfo) {
RegisterInfo *reg_info = m_resolved_value.GetRegisterInfo();
ExecutionContext exe_ctx(GetExecutionContextRef());
RegisterContext *reg_ctx = exe_ctx.GetRegisterContext();
diff --git a/lldb/source/DataFormatters/TypeFormat.cpp b/lldb/source/DataFormatters/TypeFormat.cpp
index b9a9447c5f3e..82c8b645ec84 100644
--- a/lldb/source/DataFormatters/TypeFormat.cpp
+++ b/lldb/source/DataFormatters/TypeFormat.cpp
@@ -48,7 +48,7 @@ bool TypeFormatImpl_Format::FormatObject(ValueObject *valobj,
ExecutionContext exe_ctx(valobj->GetExecutionContextRef());
DataExtractor data;
- if (context_type == Value::eContextTypeRegisterInfo) {
+ if (context_type == Value::ContextType::RegisterInfo) {
const RegisterInfo *reg_info = value.GetRegisterInfo();
if (reg_info) {
Status error;
diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp
index e54624dea06a..08dd1e2c929c 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -174,8 +174,8 @@ static bool ReadRegisterValueAsScalar(RegisterContext *reg_ctx,
RegisterValue reg_value;
if (reg_ctx->ReadRegister(reg_info, reg_value)) {
if (reg_value.GetScalarValue(value.GetScalar())) {
- value.SetValueType(Value::eValueTypeScalar);
- value.SetContext(Value::eContextTypeRegisterInfo,
+ value.SetValueType(Value::ValueType::Scalar);
+ value.SetContext(Value::ContextType::RegisterInfo,
const_cast<RegisterInfo *>(reg_info));
if (error_ptr)
error_ptr->Clear();
@@ -975,7 +975,7 @@ bool DWARFExpression::Evaluate(
// address and whose size is the size of an address on the target machine.
case DW_OP_addr:
stack.push_back(Scalar(opcodes.GetAddress(&offset)));
- stack.back().SetValueType(Value::eValueTypeFileAddress);
+ stack.back().SetValueType(Value::ValueType::FileAddress);
// Convert the file address to a load address, so subsequent
// DWARF operators can operate on it.
if (frame)
@@ -1034,14 +1034,14 @@ bool DWARFExpression::Evaluate(
}
Value::ValueType value_type = stack.back().GetValueType();
switch (value_type) {
- case Value::eValueTypeHostAddress: {
+ case Value::ValueType::HostAddress: {
void *src = (void *)stack.back().GetScalar().ULongLong();
intptr_t ptr;
::memcpy(&ptr, src, sizeof(void *));
stack.back().GetScalar() = ptr;
stack.back().ClearContext();
} break;
- case Value::eValueTypeFileAddress: {
+ case Value::ValueType::FileAddress: {
auto file_addr = stack.back().GetScalar().ULongLong(
LLDB_INVALID_ADDRESS);
if (!module_sp) {
@@ -1064,10 +1064,10 @@ bool DWARFExpression::Evaluate(
return false;
}
stack.back().GetScalar() = load_Addr;
- stack.back().SetValueType(Value::eValueTypeLoadAddress);
+ stack.back().SetValueType(Value::ValueType::LoadAddress);
// Fall through to load address code below...
} LLVM_FALLTHROUGH;
- case Value::eValueTypeLoadAddress:
+ case Value::ValueType::LoadAddress:
if (exe_ctx) {
if (process) {
lldb::addr_t pointer_addr =
@@ -1099,9 +1099,10 @@ bool DWARFExpression::Evaluate(
}
break;
- default:
+ case Value::ValueType::Scalar:
+ case Value::ValueType::Invalid:
if (error_ptr)
- error_ptr->SetErrorString("Unhandled value type for DW_OP_deref.\n");
+ error_ptr->SetErrorString("Invalid value type for DW_OP_deref.\n");
return false;
}
@@ -1129,7 +1130,7 @@ bool DWARFExpression::Evaluate(
uint8_t size = opcodes.GetU8(&offset);
Value::ValueType value_type = stack.back().GetValueType();
switch (value_type) {
- case Value::eValueTypeHostAddress: {
+ case Value::ValueType::HostAddress: {
void *src = (void *)stack.back().GetScalar().ULongLong();
intptr_t ptr;
::memcpy(&ptr, src, sizeof(void *));
@@ -1169,7 +1170,7 @@ bool DWARFExpression::Evaluate(
stack.back().GetScalar() = ptr;
stack.back().ClearContext();
} break;
- case Value::eValueTypeLoadAddress:
+ case Value::ValueType::LoadAddress:
if (exe_ctx) {
if (process) {
lldb::addr_t pointer_addr =
@@ -1209,19 +1210,23 @@ bool DWARFExpression::Evaluate(
}
} else {
if (error_ptr)
- error_ptr->SetErrorString("NULL process for DW_OP_deref.\n");
+ error_ptr->SetErrorString("NULL process for DW_OP_deref_size.\n");
return false;
}
} else {
if (error_ptr)
error_ptr->SetErrorString(
- "NULL execution context for DW_OP_deref.\n");
+ "NULL execution context for DW_OP_deref_size.\n");
return false;
}
break;
- default:
- break;
+ case Value::ValueType::Scalar:
+ case Value::ValueType::FileAddress:
+ case Value::ValueType::Invalid:
+ if (error_ptr)
+ error_ptr->SetErrorString("Invalid value for DW_OP_deref_size.\n");
+ return false;
}
} break;
@@ -2007,7 +2012,7 @@ bool DWARFExpression::Evaluate(
tmp.ResolveValue(exe_ctx) += (uint64_t)breg_offset;
tmp.ClearContext();
stack.push_back(tmp);
- stack.back().SetValueType(Value::eValueTypeLoadAddress);
+ stack.back().SetValueType(Value::ValueType::LoadAddress);
} else
return false;
} break;
@@ -2026,7 +2031,7 @@ bool DWARFExpression::Evaluate(
tmp.ResolveValue(exe_ctx) += (uint64_t)breg_offset;
tmp.ClearContext();
stack.push_back(tmp);
- stack.back().SetValueType(Value::eValueTypeLoadAddress);
+ stack.back().SetValueType(Value::ValueType::LoadAddress);
} else
return false;
} break;
@@ -2039,7 +2044,7 @@ bool DWARFExpression::Evaluate(
int64_t fbreg_offset = opcodes.GetSLEB128(&offset);
value += fbreg_offset;
stack.push_back(value);
- stack.back().SetValueType(Value::eValueTypeLoadAddress);
+ stack.back().SetValueType(Value::ValueType::LoadAddress);
} else
return false;
} else {
@@ -2103,7 +2108,9 @@ bool DWARFExpression::Evaluate(
const Value::ValueType curr_piece_source_value_type =
curr_piece_source_value.GetValueType();
switch (curr_piece_source_value_type) {
- case Value::eValueTypeLoadAddress:
+ case Value::ValueType::Invalid:
+ return false;
+ case Value::ValueType::LoadAddress:
if (process) {
if (curr_piece.ResizeData(piece_byte_size) == piece_byte_size) {
lldb::addr_t load_addr =
@@ -2130,8 +2137,8 @@ bool DWARFExpression::Evaluate(
}
break;
- case Value::eValueTypeFileAddress:
- case Value::eValueTypeHostAddress:
+ case Value::ValueType::FileAddress:
+ case Value::ValueType::HostAddress:
if (error_ptr) {
lldb::addr_t addr = curr_piece_source_value.GetScalar().ULongLong(
LLDB_INVALID_ADDRESS);
@@ -2139,14 +2146,14 @@ bool DWARFExpression::Evaluate(
"failed to read memory DW_OP_piece(%" PRIu64
") from %s address 0x%" PRIx64,
piece_byte_size, curr_piece_source_value.GetValueType() ==
- Value::eValueTypeFileAddress
+ Value::ValueType::FileAddress
? "file"
: "host",
addr);
}
return false;
- case Value::eValueTypeScalar: {
+ case Value::ValueType::Scalar: {
uint32_t bit_size = piece_byte_size * 8;
uint32_t bit_offset = 0;
Scalar &scalar = curr_piece_source_value.GetScalar();
@@ -2215,7 +2222,9 @@ bool DWARFExpression::Evaluate(
const uint64_t piece_bit_size = opcodes.GetULEB128(&offset);
const uint64_t piece_bit_offset = opcodes.GetULEB128(&offset);
switch (stack.back().GetValueType()) {
- case Value::eValueTypeScalar: {
+ case Value::ValueType::Invalid:
+ return false;
+ case Value::ValueType::Scalar: {
if (!stack.back().GetScalar().ExtractBitfield(piece_bit_size,
piece_bit_offset)) {
if (error_ptr)
@@ -2228,9 +2237,9 @@ bool DWARFExpression::Evaluate(
}
} break;
- case Value::eValueTypeFileAddress:
- case Value::eValueTypeLoadAddress:
- case Value::eValueTypeHostAddress:
+ case Value::ValueType::FileAddress:
+ case Value::ValueType::LoadAddress:
+ case Value::ValueType::HostAddress:
if (error_ptr) {
error_ptr->SetErrorStringWithFormat(
"unable to extract DW_OP_bit_piece(bit_size = %" PRIu64
@@ -2342,7 +2351,7 @@ bool DWARFExpression::Evaluate(
"Expression stack needs at least 1 item for DW_OP_stack_value.");
return false;
}
- stack.back().SetValueType(Value::eValueTypeScalar);
+ stack.back().SetValueType(Value::ValueType::Scalar);
break;
// OPCODE: DW_OP_convert
@@ -2430,7 +2439,7 @@ bool DWARFExpression::Evaluate(
addr_t cfa = id.GetCallFrameAddress();
if (cfa != LLDB_INVALID_ADDRESS) {
stack.push_back(Scalar(cfa));
- stack.back().SetValueType(Value::eValueTypeLoadAddress);
+ stack.back().SetValueType(Value::ValueType::LoadAddress);
} else if (error_ptr)
error_ptr->SetErrorString("Stack frame does not include a canonical "
"frame address for DW_OP_call_frame_cfa "
@@ -2490,7 +2499,7 @@ bool DWARFExpression::Evaluate(
}
stack.back().GetScalar() = tls_load_addr;
- stack.back().SetValueType(Value::eValueTypeLoadAddress);
+ stack.back().SetValueType(Value::ValueType::LoadAddress);
} break;
// OPCODE: DW_OP_addrx (DW_OP_GNU_addr_index is the legacy name.)
@@ -2510,7 +2519,7 @@ bool DWARFExpression::Evaluate(
uint64_t index = opcodes.GetULEB128(&offset);
lldb::addr_t value = ReadAddressFromDebugAddrSection(dwarf_cu, index);
stack.push_back(Scalar(value));
- stack.back().SetValueType(Value::eValueTypeFileAddress);
+ stack.back().SetValueType(Value::ValueType::FileAddress);
} break;
// OPCODE: DW_OP_GNU_const_index
diff --git a/lldb/source/Expression/FunctionCaller.cpp b/lldb/source/Expression/FunctionCaller.cpp
index 26ab4bfaff53..f0abdb7534bf 100644
--- a/lldb/source/Expression/FunctionCaller.cpp
+++ b/lldb/source/Expression/FunctionCaller.cpp
@@ -193,8 +193,8 @@ bool FunctionCaller::WriteFunctionArguments(
// Special case: if it's a pointer, don't do anything (the ABI supports
// passing cstrings)
- if (arg_value->GetValueType() == Value::eValueTypeHostAddress &&
- arg_value->GetContextType() == Value::eContextTypeInvalid &&
+ if (arg_value->GetValueType() == Value::ValueType::HostAddress &&
+ arg_value->GetContextType() == Value::ContextType::Invalid &&
arg_value->GetCompilerType().IsPointerType())
continue;
@@ -295,7 +295,7 @@ bool FunctionCaller::FetchFunctionResults(ExecutionContext &exe_ctx,
return false;
ret_value.SetCompilerType(m_function_return_type);
- ret_value.SetValueType(Value::eValueTypeScalar);
+ ret_value.SetValueType(Value::ValueType::Scalar);
return true;
}
diff --git a/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp b/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
index 09b319a84a08..ea0c09a1596a 100644
--- a/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
+++ b/lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
@@ -654,7 +654,7 @@ ValueObjectSP ABIMacOSX_arm64::GetReturnValueObjectImpl(
const uint32_t type_flags = return_compiler_type.GetTypeInfo(nullptr);
if (type_flags & eTypeIsScalar || type_flags & eTypeIsPointer) {
- value.SetValueType(Value::eValueTypeScalar);
+ value.SetValueType(Value::ValueType::Scalar);
bool success = false;
if (type_flags & eTypeIsInteger || type_flags & eTypeIsPointer) {
diff --git a/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp b/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp
index 1214195dcfc0..5918e2ccb5fa 100644
--- a/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp
+++ b/lldb/source/Plugins/ABI/AArch64/ABISysV_arm64.cpp
@@ -622,7 +622,7 @@ ValueObjectSP ABISysV_arm64::GetReturnValueObjectImpl(
const uint32_t type_flags = return_compiler_type.GetTypeInfo(nullptr);
if (type_flags & eTypeIsScalar || type_flags & eTypeIsPointer) {
- value.SetValueType(Value::eValueTypeScalar);
+ value.SetValueType(Value::ValueType::Scalar);
bool success = false;
if (type_flags & eTypeIsInteger || type_flags & eTypeIsPointer) {
diff --git a/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp b/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp
index 2f47d3f462d2..38d7364aaa51 100644
--- a/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp
+++ b/lldb/source/Plugins/ABI/X86/ABISysV_i386.cpp
@@ -378,14 +378,14 @@ ValueObjectSP ABISysV_i386::GetReturnValueObjectSimple(
uint32_t ptr =
thread.GetRegisterContext()->ReadRegisterAsUnsigned(eax_id, 0) &
0xffffffff;
- value.SetValueType(Value::eValueTypeScalar);
+ value.SetValueType(Value::ValueType::Scalar);
value.GetScalar() = ptr;
return_valobj_sp = ValueObjectConstResult::Create(
thread.GetStackFrameAtIndex(0).get(), value, ConstString(""));
} else if ((type_flags & eTypeIsScalar) ||
(type_flags & eTypeIsEnumeration)) //'Integral' + 'Floating Point'
{
- value.SetValueType(Value::eValueTypeScalar);
+ value.SetValueType(Value::ValueType::Scalar);
llvm::Optional<uint64_t> byte_size =
return_compiler_type.GetByteSize(&thread);
if (!byte_size)
@@ -453,7 +453,7 @@ ValueObjectSP ABISysV_i386::GetReturnValueObjectSimple(
uint32_t enm =
thread.GetRegisterContext()->ReadRegisterAsUnsigned(eax_id, 0) &
0xffffffff;
- value.SetValueType(Value::eValueTypeScalar);
+ value.SetValueType(Value::ValueType::Scalar);
value.GetScalar() = enm;
return_valobj_sp = ValueObjectConstResult::Create(
thread.GetStackFrameAtIndex(0).get(), value, ConstString(""));
diff --git a/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp b/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
index 2aa2c02b2e87..8d5614756a6a 100644
--- a/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
+++ b/lldb/source/Plugins/ABI/X86/ABISysV_x86_64.cpp
@@ -399,7 +399,7 @@ ValueObjectSP ABISysV_x86_64::GetReturnValueObjectSimple(
const uint32_t type_flags = return_compiler_type.GetTypeInfo();
if (type_flags & eTypeIsScalar) {
- value.SetValueType(Value::eValueTypeScalar);
+ value.SetValueType(Value::ValueType::Scalar);
bool success = false;
if (type_flags & eTypeIsInteger) {
@@ -487,7 +487,7 @@ ValueObjectSP ABISysV_x86_64::GetReturnValueObjectSimple(
value.GetScalar() =
(uint64_t)thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id,
0);
- value.SetValueType(Value::eValueTypeScalar);
+ value.SetValueType(Value::ValueType::Scalar);
return_valobj_sp = ValueObjectConstResult::Create(
thread.GetStackFrameAtIndex(0).get(), value, ConstString(""));
} else if (type_flags & eTypeIsVector) {
diff --git a/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp b/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp
index 06e0ce40836d..da241458840f 100644
--- a/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp
+++ b/lldb/source/Plugins/ABI/X86/ABIWindows_x86_64.cpp
@@ -408,7 +408,7 @@ ValueObjectSP ABIWindows_x86_64::GetReturnValueObjectSimple(
const uint32_t type_flags = return_compiler_type.GetTypeInfo();
if (type_flags & eTypeIsScalar) {
- value.SetValueType(Value::eValueTypeScalar);
+ value.SetValueType(Value::ValueType::Scalar);
bool success = false;
if (type_flags & eTypeIsInteger) {
@@ -494,7 +494,7 @@ ValueObjectSP ABIWindows_x86_64::GetReturnValueObjectSimple(
value.GetScalar() =
(uint64_t)thread.GetRegisterContext()->ReadRegisterAsUnsigned(rax_id,
0);
- value.SetValueType(Value::eValueTypeScalar);
+ value.SetValueType(Value::ValueType::Scalar);
return_valobj_sp = ValueObjectConstResult::Create(
thread.GetStackFrameAtIndex(0).get(), value, ConstString(""));
} else if (type_flags & eTypeIsVector) {
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
index 656a5bfe0f52..b86165a9ba9f 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
@@ -244,18 +244,18 @@ bool DynamicLoaderMacOS::NotifyBreakpointHit(void *baton,
clang_ast_context->GetBuiltinTypeForEncodingAndBitSize(
lldb::eEncodingUint, 32);
- mode_value.SetValueType(Value::eValueTypeScalar);
+ mode_value.SetValueType(Value::ValueType::Scalar);
mode_value.SetCompilerType(clang_uint32_type);
if (process->GetTarget().GetArchitecture().GetAddressByteSize() == 4) {
- count_value.SetValueType(Value::eValueTypeScalar);
+ count_value.SetValueType(Value::ValueType::Scalar);
count_value.SetCompilerType(clang_uint32_type);
} else {
- count_value.SetValueType(Value::eValueTypeScalar);
+ count_value.SetValueType(Value::ValueType::Scalar);
count_value.SetCompilerType(clang_uint64_type);
}
- headers_value.SetValueType(Value::eValueTypeScalar);
+ headers_value.SetValueType(Value::ValueType::Scalar);
headers_value.SetCompilerType(clang_void_ptr_type);
argument_values.PushValue(mode_value);
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
index 5d48273fd8eb..5cc6a6475d12 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
@@ -355,7 +355,7 @@ bool DynamicLoaderMacOSXDYLD::NotifyBreakpointHit(
CompilerType clang_uint32_type =
clang_ast_context->GetBuiltinTypeForEncodingAndBitSize(
lldb::eEncodingUint, 32);
- input_value.SetValueType(Value::eValueTypeScalar);
+ input_value.SetValueType(Value::ValueType::Scalar);
input_value.SetCompilerType(clang_uint32_type);
// input_value.SetContext (Value::eContextTypeClangType,
// clang_uint32_type);
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index 04d72ce4f021..0c943bbb0b46 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -1493,7 +1493,7 @@ bool ClangExpressionDeclMap::GetVariableValue(VariableSP &var,
if (var_location_expr.GetExpressionData(const_value_extractor)) {
var_location = Value(const_value_extractor.GetDataStart(),
const_value_extractor.GetByteSize());
- var_location.SetValueType(Value::eValueTypeHostAddress);
+ var_location.SetValueType(Value::ValueType::HostAddress);
} else {
LLDB_LOG(log, "Error evaluating constant variable: {0}", err.AsCString());
return false;
@@ -1512,10 +1512,10 @@ bool ClangExpressionDeclMap::GetVariableValue(VariableSP &var,
if (parser_type)
*parser_type = TypeFromParser(type_to_use);
- if (var_location.GetContextType() == Value::eContextTypeInvalid)
+ if (var_location.GetContextType() == Value::ContextType::Invalid)
var_location.SetCompilerType(type_to_use);
- if (var_location.GetValueType() == Value::eValueTypeFileAddress) {
+ if (var_location.GetValueType() == Value::ValueType::FileAddress) {
SymbolContext var_sc;
var->CalculateSymbolContext(&var_sc);
@@ -1529,7 +1529,7 @@ bool ClangExpressionDeclMap::GetVariableValue(VariableSP &var,
if (load_addr != LLDB_INVALID_ADDRESS) {
var_location.GetScalar() = load_addr;
- var_location.SetValueType(Value::eValueTypeLoadAddress);
+ var_location.SetValueType(Value::ValueType::LoadAddress);
}
}
@@ -1665,11 +1665,11 @@ void ClangExpressionDeclMap::AddOneGenericVariable(NameSearchContext &context,
const Address symbol_address = symbol.GetAddress();
lldb::addr_t symbol_load_addr = symbol_address.GetLoadAddress(target);
- // parser_vars->m_lldb_value.SetContext(Value::eContextTypeClangType,
+ // parser_vars->m_lldb_value.SetContext(Value::ContextType::ClangType,
// user_type.GetOpaqueQualType());
parser_vars->m_lldb_value.SetCompilerType(user_type);
parser_vars->m_lldb_value.GetScalar() = symbol_load_addr;
- parser_vars->m_lldb_value.SetValueType(Value::eValueTypeLoadAddress);
+ parser_vars->m_lldb_value.SetValueType(Value::ValueType::LoadAddress);
parser_vars->m_named_decl = var_decl;
parser_vars->m_llvm_value = nullptr;
@@ -1860,14 +1860,14 @@ void ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context,
entity->GetParserVars(GetParserID());
if (load_addr != LLDB_INVALID_ADDRESS) {
- parser_vars->m_lldb_value.SetValueType(Value::eValueTypeLoadAddress);
+ parser_vars->m_lldb_value.SetValueType(Value::ValueType::LoadAddress);
parser_vars->m_lldb_value.GetScalar() = load_addr;
} else {
// We have to try finding a file address.
lldb::addr_t file_addr = fun_address.GetFileAddress();
- parser_vars->m_lldb_value.SetValueType(Value::eValueTypeFileAddress);
+ parser_vars->m_lldb_value.SetValueType(Value::ValueType::FileAddress);
parser_vars->m_lldb_value.GetScalar() = file_addr;
}
diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
index 6ea9751f563a..f5b587c51960 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
@@ -196,7 +196,7 @@ bool ItaniumABILanguageRuntime::GetDynamicTypeAndAddress(
//
class_type_or_name.Clear();
- value_type = Value::ValueType::eValueTypeScalar;
+ value_type = Value::ValueType::Scalar;
// Only a pointer or reference type can have a
diff erent dynamic and static
// type:
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
index b37e5a9a7bf9..a49655f56ed0 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
@@ -49,7 +49,7 @@ bool AppleObjCRuntimeV1::GetDynamicTypeAndAddress(
TypeAndOrName &class_type_or_name, Address &address,
Value::ValueType &value_type) {
class_type_or_name.Clear();
- value_type = Value::ValueType::eValueTypeScalar;
+ value_type = Value::ValueType::Scalar;
if (CouldHaveDynamicValue(in_value)) {
auto class_descriptor(GetClassDescriptor(in_value));
if (class_descriptor && class_descriptor->IsValid() &&
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index ee84ccd869fc..e3b15f0ae8a8 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -451,7 +451,7 @@ bool AppleObjCRuntimeV2::GetDynamicTypeAndAddress(
assert(in_value.GetTargetSP().get() == m_process->CalculateTarget().get());
class_type_or_name.Clear();
- value_type = Value::ValueType::eValueTypeScalar;
+ value_type = Value::ValueType::Scalar;
// Make sure we can have a dynamic value before starting...
if (CouldHaveDynamicValue(in_value)) {
@@ -1346,12 +1346,12 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic(
// Next make the runner function for our implementation utility function.
Value value;
- value.SetValueType(Value::eValueTypeScalar);
+ value.SetValueType(Value::ValueType::Scalar);
value.SetCompilerType(clang_void_pointer_type);
arguments.PushValue(value);
arguments.PushValue(value);
- value.SetValueType(Value::eValueTypeScalar);
+ value.SetValueType(Value::ValueType::Scalar);
value.SetCompilerType(clang_uint32_t_type);
arguments.PushValue(value);
arguments.PushValue(value);
@@ -1420,7 +1420,7 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic(
options.SetIsForUtilityExpr(true);
Value return_value;
- return_value.SetValueType(Value::eValueTypeScalar);
+ return_value.SetValueType(Value::ValueType::Scalar);
return_value.SetCompilerType(clang_uint32_t_type);
return_value.GetScalar() = 0;
@@ -1628,12 +1628,12 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapSharedCache() {
// Next make the function caller for our implementation utility function.
Value value;
- value.SetValueType(Value::eValueTypeScalar);
+ value.SetValueType(Value::ValueType::Scalar);
value.SetCompilerType(clang_void_pointer_type);
arguments.PushValue(value);
arguments.PushValue(value);
- value.SetValueType(Value::eValueTypeScalar);
+ value.SetValueType(Value::ValueType::Scalar);
value.SetCompilerType(clang_uint32_t_type);
arguments.PushValue(value);
arguments.PushValue(value);
@@ -1698,7 +1698,7 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapSharedCache() {
options.SetIsForUtilityExpr(true);
Value return_value;
- return_value.SetValueType(Value::eValueTypeScalar);
+ return_value.SetValueType(Value::ValueType::Scalar);
return_value.SetCompilerType(clang_uint32_t_type);
return_value.GetScalar() = 0;
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
index f1d18f11b267..0abe41c3101a 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
@@ -526,7 +526,7 @@ bool AppleObjCTrampolineHandler::AppleObjCVTables::RefreshTrampolines(
CompilerType clang_void_ptr_type =
clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
- input_value.SetValueType(Value::eValueTypeScalar);
+ input_value.SetValueType(Value::ValueType::Scalar);
// input_value.SetContext (Value::eContextTypeClangType,
// clang_void_ptr_type);
input_value.SetCompilerType(clang_void_ptr_type);
@@ -936,7 +936,7 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
Value void_ptr_value;
CompilerType clang_void_ptr_type =
clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
- void_ptr_value.SetValueType(Value::eValueTypeScalar);
+ void_ptr_value.SetValueType(Value::ValueType::Scalar);
// void_ptr_value.SetContext (Value::eContextTypeClangType,
// clang_void_ptr_type);
void_ptr_value.SetCompilerType(clang_void_ptr_type);
@@ -1048,7 +1048,7 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
Value isa_value(*(argument_values.GetValueAtIndex(obj_index)));
- isa_value.SetValueType(Value::eValueTypeLoadAddress);
+ isa_value.SetValueType(Value::ValueType::LoadAddress);
isa_value.ResolveValue(&exe_ctx);
if (isa_value.GetScalar().IsValid()) {
isa_addr = isa_value.GetScalar().ULongLong();
@@ -1110,7 +1110,7 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
CompilerType clang_int_type =
clang_ast_context->GetBuiltinTypeForEncodingAndBitSize(
lldb::eEncodingSint, 32);
- flag_value.SetValueType(Value::eValueTypeScalar);
+ flag_value.SetValueType(Value::ValueType::Scalar);
// flag_value.SetContext (Value::eContextTypeClangType, clang_int_type);
flag_value.SetCompilerType(clang_int_type);
diff --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
index 3628b0a2ce5e..09ba83a4e94b 100644
--- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
+++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
@@ -659,7 +659,7 @@ PlatformPOSIX::MakeLoadImageUtilityFunction(ExecutionContext &exe_ctx,
// We are passing four arguments, the basename, the list of places to look,
// a buffer big enough for all the path + name combos, and
// a pointer to the storage we've made for the result:
- value.SetValueType(Value::eValueTypeScalar);
+ value.SetValueType(Value::ValueType::Scalar);
value.SetCompilerType(clang_void_pointer_type);
arguments.PushValue(value);
value.SetCompilerType(clang_char_pointer_type);
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 3656c7333f27..7d273cb7df1b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1784,7 +1784,7 @@ SymbolFileDWARF::GlobalVariableMap &SymbolFileDWARF::GetGlobalAranges() {
if (location.Evaluate(nullptr, LLDB_INVALID_ADDRESS, nullptr,
nullptr, location_result, &error)) {
if (location_result.GetValueType() ==
- Value::eValueTypeFileAddress) {
+ Value::ValueType::FileAddress) {
lldb::addr_t file_addr =
location_result.GetScalar().ULongLong();
lldb::addr_t byte_size = 1;
diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
index 989247bfbb49..2c619b353ac3 100644
--- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
+++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp
@@ -258,26 +258,26 @@ AppleGetItemInfoHandler::GetItemInfo(Thread &thread, uint64_t item,
CompilerType clang_void_ptr_type =
clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
Value return_buffer_ptr_value;
- return_buffer_ptr_value.SetValueType(Value::eValueTypeScalar);
+ return_buffer_ptr_value.SetValueType(Value::ValueType::Scalar);
return_buffer_ptr_value.SetCompilerType(clang_void_ptr_type);
CompilerType clang_int_type = clang_ast_context->GetBasicType(eBasicTypeInt);
Value debug_value;
- debug_value.SetValueType(Value::eValueTypeScalar);
+ debug_value.SetValueType(Value::ValueType::Scalar);
debug_value.SetCompilerType(clang_int_type);
CompilerType clang_uint64_type =
clang_ast_context->GetBasicType(eBasicTypeUnsignedLongLong);
Value item_value;
- item_value.SetValueType(Value::eValueTypeScalar);
+ item_value.SetValueType(Value::ValueType::Scalar);
item_value.SetCompilerType(clang_uint64_type);
Value page_to_free_value;
- page_to_free_value.SetValueType(Value::eValueTypeScalar);
+ page_to_free_value.SetValueType(Value::ValueType::Scalar);
page_to_free_value.SetCompilerType(clang_void_ptr_type);
Value page_to_free_size_value;
- page_to_free_size_value.SetValueType(Value::eValueTypeScalar);
+ page_to_free_size_value.SetValueType(Value::ValueType::Scalar);
page_to_free_size_value.SetCompilerType(clang_uint64_type);
std::lock_guard<std::mutex> guard(m_get_item_info_retbuffer_mutex);
diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
index 7bf158e6efeb..7fb8e7cad60f 100644
--- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
+++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
@@ -261,26 +261,26 @@ AppleGetPendingItemsHandler::GetPendingItems(Thread &thread, addr_t queue,
CompilerType clang_void_ptr_type =
clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
Value return_buffer_ptr_value;
- return_buffer_ptr_value.SetValueType(Value::eValueTypeScalar);
+ return_buffer_ptr_value.SetValueType(Value::ValueType::Scalar);
return_buffer_ptr_value.SetCompilerType(clang_void_ptr_type);
CompilerType clang_int_type = clang_ast_context->GetBasicType(eBasicTypeInt);
Value debug_value;
- debug_value.SetValueType(Value::eValueTypeScalar);
+ debug_value.SetValueType(Value::ValueType::Scalar);
debug_value.SetCompilerType(clang_int_type);
CompilerType clang_uint64_type =
clang_ast_context->GetBasicType(eBasicTypeUnsignedLongLong);
Value queue_value;
- queue_value.SetValueType(Value::eValueTypeScalar);
+ queue_value.SetValueType(Value::ValueType::Scalar);
queue_value.SetCompilerType(clang_uint64_type);
Value page_to_free_value;
- page_to_free_value.SetValueType(Value::eValueTypeScalar);
+ page_to_free_value.SetValueType(Value::ValueType::Scalar);
page_to_free_value.SetCompilerType(clang_void_ptr_type);
Value page_to_free_size_value;
- page_to_free_size_value.SetValueType(Value::eValueTypeScalar);
+ page_to_free_size_value.SetValueType(Value::ValueType::Scalar);
page_to_free_size_value.SetCompilerType(clang_uint64_type);
std::lock_guard<std::mutex> guard(m_get_pending_items_retbuffer_mutex);
diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp
index 6e652111c242..5ce9991cf244 100644
--- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp
+++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp
@@ -264,22 +264,22 @@ AppleGetQueuesHandler::GetCurrentQueues(Thread &thread, addr_t page_to_free,
CompilerType clang_void_ptr_type =
clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
Value return_buffer_ptr_value;
- return_buffer_ptr_value.SetValueType(Value::eValueTypeScalar);
+ return_buffer_ptr_value.SetValueType(Value::ValueType::Scalar);
return_buffer_ptr_value.SetCompilerType(clang_void_ptr_type);
CompilerType clang_int_type = clang_ast_context->GetBasicType(eBasicTypeInt);
Value debug_value;
- debug_value.SetValueType(Value::eValueTypeScalar);
+ debug_value.SetValueType(Value::ValueType::Scalar);
debug_value.SetCompilerType(clang_int_type);
Value page_to_free_value;
- page_to_free_value.SetValueType(Value::eValueTypeScalar);
+ page_to_free_value.SetValueType(Value::ValueType::Scalar);
page_to_free_value.SetCompilerType(clang_void_ptr_type);
CompilerType clang_uint64_type =
clang_ast_context->GetBasicType(eBasicTypeUnsignedLongLong);
Value page_to_free_size_value;
- page_to_free_size_value.SetValueType(Value::eValueTypeScalar);
+ page_to_free_size_value.SetValueType(Value::ValueType::Scalar);
page_to_free_size_value.SetCompilerType(clang_uint64_type);
std::lock_guard<std::mutex> guard(m_get_queues_retbuffer_mutex);
diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp
index 77fb0be994d6..9f6564a12b43 100644
--- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp
+++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp
@@ -262,26 +262,26 @@ AppleGetThreadItemInfoHandler::GetThreadItemInfo(Thread &thread,
CompilerType clang_void_ptr_type =
clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
Value return_buffer_ptr_value;
- return_buffer_ptr_value.SetValueType(Value::eValueTypeScalar);
+ return_buffer_ptr_value.SetValueType(Value::ValueType::Scalar);
return_buffer_ptr_value.SetCompilerType(clang_void_ptr_type);
CompilerType clang_int_type = clang_ast_context->GetBasicType(eBasicTypeInt);
Value debug_value;
- debug_value.SetValueType(Value::eValueTypeScalar);
+ debug_value.SetValueType(Value::ValueType::Scalar);
debug_value.SetCompilerType(clang_int_type);
CompilerType clang_uint64_type =
clang_ast_context->GetBasicType(eBasicTypeUnsignedLongLong);
Value thread_id_value;
- thread_id_value.SetValueType(Value::eValueTypeScalar);
+ thread_id_value.SetValueType(Value::ValueType::Scalar);
thread_id_value.SetCompilerType(clang_uint64_type);
Value page_to_free_value;
- page_to_free_value.SetValueType(Value::eValueTypeScalar);
+ page_to_free_value.SetValueType(Value::ValueType::Scalar);
page_to_free_value.SetCompilerType(clang_void_ptr_type);
Value page_to_free_size_value;
- page_to_free_size_value.SetValueType(Value::eValueTypeScalar);
+ page_to_free_size_value.SetValueType(Value::ValueType::Scalar);
page_to_free_size_value.SetCompilerType(clang_uint64_type);
std::lock_guard<std::mutex> guard(m_get_thread_item_info_retbuffer_mutex);
diff --git a/lldb/source/Target/ABI.cpp b/lldb/source/Target/ABI.cpp
index f6a531136dcb..c3342caf8742 100644
--- a/lldb/source/Target/ABI.cpp
+++ b/lldb/source/Target/ABI.cpp
@@ -120,11 +120,13 @@ ValueObjectSP ABI::GetReturnValueObject(Thread &thread, CompilerType &ast_type,
const Value &result_value = live_valobj_sp->GetValue();
switch (result_value.GetValueType()) {
- case Value::eValueTypeHostAddress:
- case Value::eValueTypeFileAddress:
- // we don't do anything with these for now
+ case Value::ValueType::Invalid:
+ return {};
+ case Value::ValueType::HostAddress:
+ case Value::ValueType::FileAddress:
+ // we odon't do anything with these for now
break;
- case Value::eValueTypeScalar:
+ case Value::ValueType::Scalar:
expr_variable_sp->m_flags |=
ExpressionVariable::EVIsFreezeDried;
expr_variable_sp->m_flags |=
@@ -132,7 +134,7 @@ ValueObjectSP ABI::GetReturnValueObject(Thread &thread, CompilerType &ast_type,
expr_variable_sp->m_flags |=
ExpressionVariable::EVNeedsAllocation;
break;
- case Value::eValueTypeLoadAddress:
+ case Value::ValueType::LoadAddress:
expr_variable_sp->m_live_sp = live_valobj_sp;
expr_variable_sp->m_flags |=
ExpressionVariable::EVIsProgramReference;
diff --git a/lldb/source/Target/RegisterContextUnwind.cpp b/lldb/source/Target/RegisterContextUnwind.cpp
index f33f4180be23..991a3c821923 100644
--- a/lldb/source/Target/RegisterContextUnwind.cpp
+++ b/lldb/source/Target/RegisterContextUnwind.cpp
@@ -1521,7 +1521,7 @@ RegisterContextUnwind::SavedLocationForRegister(
DWARFExpression dwarfexpr(opcode_ctx, dwarfdata, nullptr);
dwarfexpr.SetRegisterKind(unwindplan_registerkind);
Value cfa_val = Scalar(m_cfa);
- cfa_val.SetValueType(Value::eValueTypeLoadAddress);
+ cfa_val.SetValueType(Value::ValueType::LoadAddress);
Value result;
Status error;
if (dwarfexpr.Evaluate(&exe_ctx, this, 0, &cfa_val, nullptr, result,
diff --git a/lldb/source/Target/ThreadPlanTracer.cpp b/lldb/source/Target/ThreadPlanTracer.cpp
index c00415f3c1ee..e7ef0af8ec2d 100644
--- a/lldb/source/Target/ThreadPlanTracer.cpp
+++ b/lldb/source/Target/ThreadPlanTracer.cpp
@@ -191,7 +191,7 @@ void ThreadPlanAssemblyTracer::Log() {
for (int arg_index = 0; arg_index < num_args; ++arg_index) {
Value value;
- value.SetValueType(Value::eValueTypeScalar);
+ value.SetValueType(Value::ValueType::Scalar);
value.SetCompilerType(intptr_type);
value_list.PushValue(value);
}
diff --git a/lldb/unittests/Expression/DWARFExpressionTest.cpp b/lldb/unittests/Expression/DWARFExpressionTest.cpp
index 5f2da7070e06..ef89749ba7f8 100644
--- a/lldb/unittests/Expression/DWARFExpressionTest.cpp
+++ b/lldb/unittests/Expression/DWARFExpressionTest.cpp
@@ -34,9 +34,9 @@ static llvm::Expected<Scalar> Evaluate(llvm::ArrayRef<uint8_t> expr,
return status.ToError();
switch (result.GetValueType()) {
- case Value::eValueTypeScalar:
+ case Value::ValueType::Scalar:
return result.GetScalar();
- case Value::eValueTypeHostAddress: {
+ case Value::ValueType::HostAddress: {
// Convert small buffers to scalars to simplify the tests.
DataBufferHeap &buf = result.GetBuffer();
if (buf.GetByteSize() <= 8) {
More information about the lldb-commits
mailing list