diff options
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 13bd12ee204..ec5c2ba399e 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -599,8 +599,7 @@ void DwarfCompileUnit::constructSubprogramScopeDIE(LexicalScope *Scope) { // Collect lexical scope children first. // ObjectPointer might be a local (non-argument) local variable if it's a // block's synthetic this pointer. - if (DIE *BlockObjPtr = - DD->createAndAddScopeChildren(*this, Scope, ScopeDIE)) { + if (DIE *BlockObjPtr = createAndAddScopeChildren(Scope, ScopeDIE)) { assert(!ObjectPointer && "multiple object pointers can't be described"); ObjectPointer = BlockObjPtr; } @@ -609,4 +608,17 @@ void DwarfCompileUnit::constructSubprogramScopeDIE(LexicalScope *Scope) { addDIEEntry(ScopeDIE, dwarf::DW_AT_object_pointer, *ObjectPointer); } +DIE *DwarfCompileUnit::createAndAddScopeChildren(LexicalScope *Scope, + DIE &ScopeDIE) { + // We create children when the scope DIE is not null. + SmallVector<std::unique_ptr<DIE>, 8> Children; + DIE *ObjectPointer = createScopeChildrenDIE(Scope, Children); + + // Add children + for (auto &I : Children) + ScopeDIE.addChild(std::move(I)); + + return ObjectPointer; +} + } // end llvm namespace |