@@ -97,14 +97,12 @@ void DWARFUnit::ExtractUnitDIEIfNeeded() {
97
97
*m_dwo_id, m_first_die.GetOffset ()));
98
98
return ; // Can't fetch the compile unit from the dwo file.
99
99
}
100
-
101
- // Link the DWO unit to this object, if it hasn't been linked already (this
102
- // can happen when we have an index, and the DWO unit is parsed first).
103
- if (!dwo_cu->LinkToSkeletonUnit (*this )) {
104
- SetDwoError (Status::createWithFormat (
105
- " multiple compile units with Dwo ID {0:x16}" , *m_dwo_id));
106
- return ;
107
- }
100
+ // If the skeleton compile unit gets its unit DIE parsed first, then this
101
+ // will fill in the DWO file's back pointer to this skeleton compile unit.
102
+ // If the DWO files get parsed on their own first the skeleton back link
103
+ // can be done manually in DWARFUnit::GetSkeletonCompileUnit() which will
104
+ // do a reverse lookup and cache the result.
105
+ dwo_cu->SetSkeletonUnit (this );
108
106
109
107
DWARFBaseDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly ();
110
108
if (!dwo_cu_die.IsValid ()) {
@@ -720,11 +718,13 @@ DWARFCompileUnit *DWARFUnit::GetSkeletonUnit() {
720
718
return llvm::dyn_cast_or_null<DWARFCompileUnit>(m_skeleton_unit);
721
719
}
722
720
723
- bool DWARFUnit::LinkToSkeletonUnit (DWARFUnit &skeleton_unit) {
724
- if (m_skeleton_unit && m_skeleton_unit != &skeleton_unit)
725
- return false ;
726
- m_skeleton_unit = &skeleton_unit;
727
- return true ;
721
+ void DWARFUnit::SetSkeletonUnit (DWARFUnit *skeleton_unit) {
722
+ // If someone is re-setting the skeleton compile unit backlink, make sure
723
+ // it is setting it to a valid value when it wasn't valid, or if the
724
+ // value in m_skeleton_unit was valid, it should be the same value.
725
+ assert (skeleton_unit);
726
+ assert (m_skeleton_unit == nullptr || m_skeleton_unit == skeleton_unit);
727
+ m_skeleton_unit = skeleton_unit;
728
728
}
729
729
730
730
bool DWARFUnit::Supports_DW_AT_APPLE_objc_complete_type () {
0 commit comments