@@ -782,6 +782,8 @@ DIE *DwarfCompileUnit::constructLexicalScopeDIE(LexicalScope *Scope) {
782
782
assert (!LexicalBlockDIEs.count (DS) &&
783
783
" Concrete out-of-line DIE for this scope exists!" );
784
784
LexicalBlockDIEs[DS] = ScopeDIE;
785
+ } else {
786
+ InlinedLocalScopeDIEs[DS].push_back (ScopeDIE);
785
787
}
786
788
787
789
attachRangesOrLowHighPC (*ScopeDIE, Scope->getRanges ());
@@ -1491,6 +1493,19 @@ void DwarfCompileUnit::finishEntityDefinition(const DbgEntity *Entity) {
1491
1493
getDwarfDebug ().addAccelName (*this , CUNode->getNameTableKind (), Name, *Die);
1492
1494
}
1493
1495
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
+
1494
1509
DbgEntity *DwarfCompileUnit::getExistingAbstractEntity (const DINode *Node) {
1495
1510
auto &AbstractEntities = getAbstractEntities ();
1496
1511
auto I = AbstractEntities.find (Node);
0 commit comments