[Lldb-commits] [lldb] [LLDB][NativePDB] Add non-overlapping fields in root struct (PR #166243)

Zequan Wu via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 3 16:46:55 PST 2025


================
@@ -463,7 +467,14 @@ void UdtRecordCompleter::Record::ConstructRecord() {
       if (iter->second.empty())
         continue;
       parent = iter->second.back();
-      iter->second.pop_back();
+
+      // For structs, if the new fields come after the already added ones
+      // without overlap, go back to the root struct.
+      if (parent != &record && iter->first <= offset &&
+          record.kind == Member::Struct && is_last_end_offset(iter))
+        parent = &record;
+      else
+        iter->second.pop_back();
----------------
ZequanWu wrote:

```suggestion
      // For structs, if the new fields come after the already added ones
      // without overlap, go back to the root struct.
      if (iter->first <= offset &&
          record.kind == Member::Struct && is_last_end_offset(iter))
        parent = &record;
      else {
        parent = iter->second.back();
        iter->second.pop_back();
      }
```
Maybe move `parent = iter->second.back();` into the else branch. 

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


More information about the lldb-commits mailing list