[Lldb-commits] [lldb] [lldb] Tolerate multiple compile units with the same DWO ID (PR #100577)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Fri Jul 26 01:49:44 PDT 2024


================
@@ -718,13 +720,11 @@ DWARFCompileUnit *DWARFUnit::GetSkeletonUnit() {
   return llvm::dyn_cast_or_null<DWARFCompileUnit>(m_skeleton_unit);
 }
 
-void DWARFUnit::SetSkeletonUnit(DWARFUnit *skeleton_unit) {
-  // If someone is re-setting the skeleton compile unit backlink, make sure
-  // it is setting it to a valid value when it wasn't valid, or if the
-  // value in m_skeleton_unit was valid, it should be the same value.
-  assert(skeleton_unit);
-  assert(m_skeleton_unit == nullptr || m_skeleton_unit == skeleton_unit);
-  m_skeleton_unit = skeleton_unit;
+bool DWARFUnit::LinkToSkeletonUnit(DWARFUnit &skeleton_unit) {
----------------
labath wrote:

A reference implies (and documents) non-nullness of the argument. This removes the need for the `assert(skeleton_unit);` inside the function and makes it clear to the caller that it must pass a valid object. I don't strongly about it, but I think that's worth an extra `*` at the call site.

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


More information about the lldb-commits mailing list