diff options
Diffstat (limited to 'source/Expression/Materializer.cpp')
-rw-r--r-- | source/Expression/Materializer.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/source/Expression/Materializer.cpp b/source/Expression/Materializer.cpp index 74a965e015ce..4d4e5e21092c 100644 --- a/source/Expression/Materializer.cpp +++ b/source/Expression/Materializer.cpp @@ -7,13 +7,8 @@ // //===----------------------------------------------------------------------===// -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Expression/Materializer.h" #include "lldb/Core/DumpDataExtractor.h" -#include "lldb/Core/RegisterValue.h" #include "lldb/Core/ValueObjectConstResult.h" #include "lldb/Core/ValueObjectVariable.h" #include "lldb/Expression/ExpressionVariable.h" @@ -27,6 +22,7 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/RegisterValue.h" using namespace lldb_private; @@ -50,7 +46,8 @@ uint32_t Materializer::AddStructMember(Entity &entity) { } void Materializer::Entity::SetSizeAndAlignmentFromType(CompilerType &type) { - m_size = type.GetByteSize(nullptr); + if (llvm::Optional<uint64_t> size = type.GetByteSize(nullptr)) + m_size = *size; uint32_t bit_alignment = type.GetTypeBitAlign(); @@ -532,7 +529,7 @@ public: if (data.GetByteSize() < m_variable_sp->GetType()->GetByteSize()) { if (data.GetByteSize() == 0 && - m_variable_sp->LocationExpression().IsValid() == false) { + !m_variable_sp->LocationExpression().IsValid()) { err.SetErrorStringWithFormat("the variable '%s' has no location, " "it may have been optimized out", m_variable_sp->GetName().AsCString()); @@ -798,7 +795,11 @@ public: ExecutionContextScope *exe_scope = map.GetBestExecutionContextScope(); - size_t byte_size = m_type.GetByteSize(exe_scope); + llvm::Optional<uint64_t> byte_size = m_type.GetByteSize(exe_scope); + if (!byte_size) { + err.SetErrorString("can't get size of type"); + return; + } size_t bit_align = m_type.GetTypeBitAlign(); size_t byte_align = (bit_align + 7) / 8; @@ -809,10 +810,10 @@ public: const bool zero_memory = true; m_temporary_allocation = map.Malloc( - byte_size, byte_align, + *byte_size, byte_align, lldb::ePermissionsReadable | lldb::ePermissionsWritable, IRMemoryMap::eAllocationPolicyMirror, zero_memory, alloc_error); - m_temporary_allocation_size = byte_size; + m_temporary_allocation_size = *byte_size; if (!alloc_error.Success()) { err.SetErrorStringWithFormat( |