forked from OSchip/llvm-project
Fixing an issue where the expression parser was not correctly freeze-drying bitfields - This patch ensures that (a) freeze-drying bitfields works correctly and (b) that we actually access bitfields through IR instead of the 'frame var en lieu of expr' shortcut, for added safety in corner cases that may arise
llvm-svn: 155494
This commit is contained in:
parent
e35cc3bff8
commit
9f1e204130
|
@ -656,17 +656,23 @@ public:
|
|||
}
|
||||
|
||||
virtual uint32_t
|
||||
GetBitfieldBitSize()
|
||||
GetBitfieldBitSize ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual uint32_t
|
||||
GetBitfieldBitOffset()
|
||||
GetBitfieldBitOffset ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool
|
||||
IsBitfield ()
|
||||
{
|
||||
return (GetBitfieldBitSize() != 0) || (GetBitfieldOffset() != 0);
|
||||
}
|
||||
|
||||
virtual bool
|
||||
IsArrayItemForPointer()
|
||||
{
|
||||
|
|
|
@ -3485,7 +3485,13 @@ ValueObject::CreateConstantValue (const ConstString &name)
|
|||
data.SetByteOrder (m_data.GetByteOrder());
|
||||
data.SetAddressByteSize(m_data.GetAddressByteSize());
|
||||
|
||||
m_error = m_value.GetValueAsData (&exe_ctx, ast, data, 0, GetModule().get());
|
||||
if (IsBitfield())
|
||||
{
|
||||
Value v(Scalar(GetValueAsUnsigned(UINT64_MAX)));
|
||||
m_error = v.GetValueAsData (&exe_ctx, ast, data, 0, GetModule().get());
|
||||
}
|
||||
else
|
||||
m_error = m_value.GetValueAsData (&exe_ctx, ast, data, 0, GetModule().get());
|
||||
|
||||
valobj_sp = ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(),
|
||||
ast,
|
||||
|
|
|
@ -1594,6 +1594,9 @@ Target::EvaluateExpression
|
|||
expr_path_options,
|
||||
var_sp,
|
||||
error);
|
||||
// if this expression results in a bitfield, we give up and let the IR handle it
|
||||
if (result_valobj_sp && result_valobj_sp->IsBitfield())
|
||||
result_valobj_sp.reset();
|
||||
}
|
||||
}
|
||||
else if (m_process_sp)
|
||||
|
|
Loading…
Reference in New Issue