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

via lldb-commits lldb-commits at lists.llvm.org
Sun Nov 1 23:22:48 PST 2026


Walnut356 wrote:

If I'm understanding this correctly, it looks like DWARF can represent the absence of a length, in which case `DWARFASTParserClang` passes `nullopt` when creating an array

https://github.com/llvm/llvm-project/blob/f7c2c4938886373b9fae1c4ea221f0db01835b74/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp#L1496-L1511

PDB passes the length in directly instead of `nullopt`. Rust uses the same code to create the empty array types regardless of if it's generating for PDB or DWARF debug info:

https://github.com/rust-lang/rust/blob/2a01bd6f8ba2b81badc578a7fa927d4ff00f8c71/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs#L422-L437

so presumably LLVM is setting the length of an `LF_ARRAY` node to 0 when translating to CodeView, e.g.:

```
  0x1029 | LF_ARRAY [size = 16]
           size: 0, index type: 0x0023 (unsigned __int64), element type: 0x1028
```        

Based on the [codeview spec](http://x-ways.net/winhex/kb/ff/PE_EXE.pdf), it looks like maybe `LF_BARRAY` is the output we want from LLVM in this case instead? It only stores an element type index, rather than element type + index type + length + name (speaking of which, LLVM's DIBuilder doesn't have any param to specify a name when creating array types even though both DWARF and CodeView array nodes can store names).

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


More information about the lldb-commits mailing list