================
@@ -462,8 +466,23 @@ void UdtRecordCompleter::Record::ConstructRecord() {
       }
       if (iter->second.empty())
         continue;
-      parent = iter->second.back();
-      iter->second.pop_back();
+
+      // If the new fields come after the already added ones
+      // without overlap, go back to the root.
+      if (iter->first <= offset && is_last_end_offset(iter)) {
+        if (record.kind == Member::Struct)
+          parent = &record;
+        else {
+          lldbassert(record.kind == Member::Union &&
+                     "Current record must be a union");
+          lldbassert(!record.fields.empty());
----------------
JDevlieghere wrote:

Per https://lldb.llvm.org/resources/contributing.html#error-handling, we'd 
rather not add new uses of `lldbassert`. If these are proper preconditions, 
they can be converted to regular asserts. 

https://github.com/llvm/llvm-project/pull/166243
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to