summaryrefslogtreecommitdiff
path: root/source/Expression/Materializer.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-01-19 10:06:29 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-01-19 10:06:29 +0000
commit94994d372d014ce4c8758b9605d63fae651bd8aa (patch)
tree51c0b708bd59f205d6b35cb2a8c24d62f0c33d77 /source/Expression/Materializer.cpp
parent39be7ce23363d12ae3e49aeb1fdb2bfeb892e836 (diff)
Notes
Diffstat (limited to 'source/Expression/Materializer.cpp')
-rw-r--r--source/Expression/Materializer.cpp21
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(