Skip to content

Commit 3606b56

Browse files
committed
ValueObject: Upstream early-exit from swift-lldb. (NFC)
1 parent 63f4946 commit 3606b56

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lldb/source/Core/Value.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,12 @@ Status Value::GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data,
322322
AddressType address_type = eAddressTypeFile;
323323
Address file_so_addr;
324324
const CompilerType &ast_type = GetCompilerType();
325+
llvm::Optional<uint64_t> type_size = ast_type.GetByteSize(
326+
exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr);
327+
// Nothing to be done for a zero-sized type.
328+
if (type_size && *type_size == 0)
329+
return error;
330+
325331
switch (m_value_type) {
326332
case eValueTypeVector:
327333
if (ast_type.IsValid())
@@ -340,9 +346,8 @@ Status Value::GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data,
340346

341347
uint32_t limit_byte_size = UINT32_MAX;
342348

343-
if (llvm::Optional<uint64_t> size = ast_type.GetByteSize(
344-
exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr))
345-
limit_byte_size = *size;
349+
if (type_size)
350+
limit_byte_size = *type_size;
346351

347352
if (limit_byte_size <= m_value.GetByteSize()) {
348353
if (m_value.GetData(data, limit_byte_size))

0 commit comments

Comments
 (0)