[Lldb-commits] [lldb] r344982 - [ValueObject] Stop assuming types are non-zero sized.

Davide Italiano via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 23 07:50:46 PDT 2018


This is a little different. It's not an empty structural type, it's a
children with zero size, that has an implicit representation (swift
uses tagged bits to represent cases in an enumeration, hence IRGen
says the size of the type is zero). I don't think there's any
equivalent of this in C++, but I might be wrong, so I'll give this a
try, but no promises I'll succeed.

--
Davide
On Tue, Oct 23, 2018 at 2:21 AM Raphael Isemann via lldb-commits
<lldb-commits at lists.llvm.org> wrote:
>
> You maybe able to add a test for that in C++: Clang types can have 0
> size, the padding from 0 to 1 happens in the CodeGen IIRC. See also
> this bug: https://bugs.llvm.org/show_bug.cgi?id=31612
>
> - Raphael
> Am Di., 23. Okt. 2018 um 02:33 Uhr schrieb Davide Italiano via
> lldb-commits <lldb-commits at lists.llvm.org>:
> >
> > 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;
> >
> >
> >
> > _______________________________________________
> > lldb-commits mailing list
> > lldb-commits at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


More information about the lldb-commits mailing list