diff options
author | Michael Buch <michaelbuch12@gmail.com> | 2022-07-07 15:53:30 +0100 |
---|---|---|
committer | Michael Buch <michaelbuch12@gmail.com> | 2022-07-22 08:02:07 +0100 |
commit | fcf4e252f4d992cade4bdfe5aed10ff96fa40202 (patch) | |
tree | 0b55ab70e0f9834b944c6ae25beb896c20c4dcfa /lldb/source/Expression/Materializer.cpp | |
parent | 18cee95919c8a9bf1a2d1c23fbbc7dc63077ee86 (diff) | |
download | llvm-fcf4e252f4d992cade4bdfe5aed10ff96fa40202.zip llvm-fcf4e252f4d992cade4bdfe5aed10ff96fa40202.tar.gz llvm-fcf4e252f4d992cade4bdfe5aed10ff96fa40202.tar.bz2 |
[LLDB][NFC] Create variable for hardcoded alignment/size constants in materializer
Diffstat (limited to 'lldb/source/Expression/Materializer.cpp')
-rw-r--r-- | lldb/source/Expression/Materializer.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/lldb/source/Expression/Materializer.cpp b/lldb/source/Expression/Materializer.cpp index 965a96b..8c7e74b 100644 --- a/lldb/source/Expression/Materializer.cpp +++ b/lldb/source/Expression/Materializer.cpp @@ -27,6 +27,14 @@ using namespace lldb_private; +// FIXME: these should be retrieved from the target +// instead of being hard-coded. Currently we +// assume that persistent vars are materialized +// as references, and thus pick the size of a +// 64-bit pointer. +static constexpr uint32_t g_default_var_alignment = 8; +static constexpr uint32_t g_default_var_byte_size = 8; + uint32_t Materializer::AddStructMember(Entity &entity) { uint32_t size = entity.GetSize(); uint32_t alignment = entity.GetAlignment(); @@ -54,8 +62,8 @@ public: m_delegate(delegate) { // Hard-coding to maximum size of a pointer since persistent variables are // materialized by reference - m_size = 8; - m_alignment = 8; + m_size = g_default_var_byte_size; + m_alignment = g_default_var_alignment; } void MakeAllocation(IRMemoryMap &map, Status &err) { @@ -418,8 +426,8 @@ public: : Entity(), m_variable_sp(variable_sp) { // Hard-coding to maximum size of a pointer since all variables are // materialized by reference - m_size = 8; - m_alignment = 8; + m_size = g_default_var_byte_size; + m_alignment = g_default_var_alignment; m_is_reference = m_variable_sp->GetType()->GetForwardCompilerType().IsReferenceType(); } @@ -772,8 +780,8 @@ public: m_keep_in_memory(keep_in_memory), m_delegate(delegate) { // Hard-coding to maximum size of a pointer since all results are // materialized by reference - m_size = 8; - m_alignment = 8; + m_size = g_default_var_byte_size; + m_alignment = g_default_var_alignment; } void Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, @@ -1050,8 +1058,8 @@ class EntitySymbol : public Materializer::Entity { public: EntitySymbol(const Symbol &symbol) : Entity(), m_symbol(symbol) { // Hard-coding to maximum size of a symbol - m_size = 8; - m_alignment = 8; + m_size = g_default_var_byte_size; + m_alignment = g_default_var_alignment; } void Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, |