Rework the way in which ValueObjectChild decides how to update itself; this is a slight refactoring that I need as part of a larger master plan. As such, should be NFC

llvm-svn: 252529
This commit is contained in:
Enrico Granata 2015-11-09 23:07:55 +00:00
parent 2652b75700
commit 99448c6367
5 changed files with 20 additions and 2 deletions

View File

@ -180,6 +180,9 @@ public:
bool
IsReferenceType(CompilerType *pointee_type = nullptr, bool* is_rvalue = nullptr) const;
bool
ShouldTreatScalarValueAsAddress () const;
bool
IsScalarType () const;

View File

@ -496,6 +496,12 @@ public:
virtual bool
IsReferenceType (lldb::opaque_compiler_type_t type, CompilerType *pointee_type, bool* is_rvalue) = 0;
virtual bool
ShouldTreatScalarValueAsAddress (lldb::opaque_compiler_type_t type)
{
return IsPointerOrReferenceType(type, nullptr);
}
virtual UserExpression *
GetUserExpression (const char *expr,
const char *expr_prefix,

View File

@ -960,7 +960,8 @@ namespace lldb {
eTypeIsInteger = (1u << 18),
eTypeIsFloat = (1u << 19),
eTypeIsComplex = (1u << 20),
eTypeIsSigned = (1u << 21)
eTypeIsSigned = (1u << 21),
eTypeInstanceIsPointer = (1u << 22)
};
FLAGS_ENUM(CommandFlags)

View File

@ -146,7 +146,7 @@ ValueObjectChild::UpdateValue ()
Value::ValueType value_type = parent->GetValue().GetValueType();
m_value.SetValueType (value_type);
if (parent->GetCompilerType().IsPointerOrReferenceType ())
if (parent->GetCompilerType().ShouldTreatScalarValueAsAddress())
{
lldb::addr_t addr = parent->GetPointerValue ();
m_value.GetScalar() = addr;

View File

@ -226,6 +226,14 @@ CompilerType::IsReferenceType (CompilerType *pointee_type, bool* is_rvalue) cons
return false;
}
bool
CompilerType::ShouldTreatScalarValueAsAddress () const
{
if (IsValid())
return m_type_system->ShouldTreatScalarValueAsAddress(m_type);
return false;
}
bool
CompilerType::IsFloatingPointType (uint32_t &count, bool &is_complex) const
{