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
|
@ -667,6 +667,12 @@ public:
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool
|
||||
IsBitfield ()
|
||||
{
|
||||
return (GetBitfieldBitSize() != 0) || (GetBitfieldOffset() != 0);
|
||||
}
|
||||
|
||||
virtual bool
|
||||
IsArrayItemForPointer()
|
||||
{
|
||||
|
|
|
@ -3485,6 +3485,12 @@ ValueObject::CreateConstantValue (const ConstString &name)
|
|||
data.SetByteOrder (m_data.GetByteOrder());
|
||||
data.SetAddressByteSize(m_data.GetAddressByteSize());
|
||||
|
||||
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(),
|
||||
|
|
|
@ -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