[Lldb-commits] [lldb] r344982 - [ValueObject] Stop assuming types are non-zero sized.
Davide Italiano via lldb-commits
lldb-commits at lists.llvm.org
Mon Oct 22 17:31:46 PDT 2018
Author: davide
Date: Mon Oct 22 17:31:46 2018
New Revision: 344982
URL: http://llvm.org/viewvc/llvm-project?rev=344982&view=rev
Log:
[ValueObject] Stop assuming types are non-zero sized.
Some backends might violate this assumption. No test case
upstream unfortunately as this is not the case with C++,
but I'm going to add a test in swift language support.
<rdar://problem/40962410>
Modified:
lldb/trunk/source/Core/ValueObjectConstResultImpl.cpp
Modified: lldb/trunk/source/Core/ValueObjectConstResultImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectConstResultImpl.cpp?rev=344982&r1=344981&r2=344982&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectConstResultImpl.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectConstResultImpl.cpp Mon Oct 22 17:31:46 2018
@@ -77,7 +77,13 @@ ValueObject *ValueObjectConstResultImpl:
ignore_array_bounds, child_name_str, child_byte_size, child_byte_offset,
child_bitfield_bit_size, child_bitfield_bit_offset, child_is_base_class,
child_is_deref_of_parent, m_impl_backend, language_flags);
- if (child_compiler_type && child_byte_size) {
+
+ // One might think we should check that the size of the children
+ // is always strictly positive, hence we could avoid creating a
+ // ValueObject if that's not the case, but it turns out there
+ // are languages out there which allow zero-size types with
+ // children (e.g. Swift).
+ if (child_compiler_type) {
if (synthetic_index)
child_byte_offset += child_byte_size * synthetic_index;
More information about the lldb-commits
mailing list