Skip to content

Commit 8ce02bc

Browse files
committed
[lldb] Implement GetValueTypeFromAddressType
Value::ValueType is a superset of AddressType. Add a function to convert an AddressType into a Value::ValueType. Differential Revision: https://reviews.llvm.org/D150826 (cherry picked from commit 8fe9718)
1 parent 35c8d4d commit 8ce02bc

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

lldb/include/lldb/Core/Value.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ class Value {
145145

146146
void Clear();
147147

148+
static ValueType GetValueTypeFromAddressType(AddressType address_type);
149+
148150
protected:
149151
Scalar m_value;
150152
CompilerType m_compiler_type;

lldb/source/Core/Value.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,20 @@ AddressType Value::GetValueAddressType() const {
120120
return eAddressTypeInvalid;
121121
}
122122

123+
Value::ValueType Value::GetValueTypeFromAddressType(AddressType address_type) {
124+
switch (address_type) {
125+
case eAddressTypeFile:
126+
return Value::ValueType::FileAddress;
127+
case eAddressTypeLoad:
128+
return Value::ValueType::LoadAddress;
129+
case eAddressTypeHost:
130+
return Value::ValueType::HostAddress;
131+
case eAddressTypeInvalid:
132+
return Value::ValueType::Invalid;
133+
}
134+
llvm_unreachable("Unexpected address type!");
135+
}
136+
123137
RegisterInfo *Value::GetRegisterInfo() const {
124138
if (m_context_type == ContextType::RegisterInfo)
125139
return static_cast<RegisterInfo *>(m_context);

0 commit comments

Comments
 (0)