[Lldb-commits] [lldb] 3606b56 - ValueObject: Upstream early-exit from swift-lldb. (NFC)
Adrian Prantl via lldb-commits
lldb-commits at lists.llvm.org
Tue Nov 5 10:54:03 PST 2019
Author: Adrian Prantl
Date: 2019-11-05T10:53:57-08:00
New Revision: 3606b567849a935ef6bf627dec2e6100a8f25c4b
URL: https://github.com/llvm/llvm-project/commit/3606b567849a935ef6bf627dec2e6100a8f25c4b
DIFF: https://github.com/llvm/llvm-project/commit/3606b567849a935ef6bf627dec2e6100a8f25c4b.diff
LOG: ValueObject: Upstream early-exit from swift-lldb. (NFC)
Added:
Modified:
lldb/source/Core/Value.cpp
Removed:
################################################################################
diff --git a/lldb/source/Core/Value.cpp b/lldb/source/Core/Value.cpp
index aa713d58dace..c70ab98dcdfa 100644
--- a/lldb/source/Core/Value.cpp
+++ b/lldb/source/Core/Value.cpp
@@ -322,6 +322,12 @@ Status Value::GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data,
AddressType address_type = eAddressTypeFile;
Address file_so_addr;
const CompilerType &ast_type = GetCompilerType();
+ llvm::Optional<uint64_t> type_size = ast_type.GetByteSize(
+ exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr);
+ // Nothing to be done for a zero-sized type.
+ if (type_size && *type_size == 0)
+ return error;
+
switch (m_value_type) {
case eValueTypeVector:
if (ast_type.IsValid())
@@ -340,9 +346,8 @@ Status Value::GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data,
uint32_t limit_byte_size = UINT32_MAX;
- if (llvm::Optional<uint64_t> size = ast_type.GetByteSize(
- exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr))
- limit_byte_size = *size;
+ if (type_size)
+ limit_byte_size = *type_size;
if (limit_byte_size <= m_value.GetByteSize()) {
if (m_value.GetData(data, limit_byte_size))
More information about the lldb-commits
mailing list