[Lldb-commits] [lldb] [lldb][Native PDB] don't omit 0-sized struct fields (PR #237688)

via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 2 01:25:36 PST 2026


Nerixyz wrote:

> One other question, is "incomplete type" an LLDB/clang implementation detail, or is it just a synonym for "forward ref"?

A forward reference is CodeView/PDB specific, because of the constraint that type records cannot contain type indices higher than their own.
But we do model forward references as incomplete if we haven't visited their members yet (e.g. because we only found a forward decl for now).

---

> Conversely, the DWARF data is listed as:
> 
> ```c
> struct A {
>     unsigned long long x;
>     unsigned short y;
>     temp::Sized data[];
> }
> ```
> 
> where the type of `data` is considered to be the size of 1 `temp::Sized` element.

In C, `data` would not take any space, since it's a flexible array member. The way PDB models the member as `data[0]` is not allowed by the standard, but it's a GCC and Clang extension. But in either case, it won't take any space.



https://github.com/llvm/llvm-project/pull/237688


More information about the lldb-commits mailing list