@@ -782,6 +782,8 @@ DIE *DwarfCompileUnit::constructLexicalScopeDIE(LexicalScope *Scope) {
782782 assert (!LexicalBlockDIEs.count (DS) &&
783783 " Concrete out-of-line DIE for this scope exists!" );
784784 LexicalBlockDIEs[DS] = ScopeDIE;
785+ } else {
786+ InlinedLocalScopeDIEs[DS].push_back (ScopeDIE);
785787 }
786788
787789 attachRangesOrLowHighPC (*ScopeDIE, Scope->getRanges ());
@@ -1491,6 +1493,19 @@ void DwarfCompileUnit::finishEntityDefinition(const DbgEntity *Entity) {
14911493 getDwarfDebug ().addAccelName (*this , CUNode->getNameTableKind (), Name, *Die);
14921494}
14931495
1496+ void DwarfCompileUnit::attachLexicalScopesAbstractOrigins () {
1497+ auto AttachAO = [&](const DILocalScope *LS, DIE *ScopeDIE) {
1498+ if (auto *AbsLSDie = getAbstractScopeDIEs ().lookup (LS))
1499+ addDIEEntry (*ScopeDIE, dwarf::DW_AT_abstract_origin, *AbsLSDie);
1500+ };
1501+
1502+ for (auto [LScope, ScopeDIE] : LexicalBlockDIEs)
1503+ AttachAO (LScope, ScopeDIE);
1504+ for (auto &[LScope, ScopeDIEs] : InlinedLocalScopeDIEs)
1505+ for (auto *ScopeDIE : ScopeDIEs)
1506+ AttachAO (LScope, ScopeDIE);
1507+ }
1508+
14941509DbgEntity *DwarfCompileUnit::getExistingAbstractEntity (const DINode *Node) {
14951510 auto &AbstractEntities = getAbstractEntities ();
14961511 auto I = AbstractEntities.find (Node);
0 commit comments