DIE: Pass ownership of children via std::unique_ptr rather than raw pointer.

This should reduce the chance of memory leaks like those fixed in
r207240.

There's still some unclear ownership of DIEs happening in DwarfDebug.
Pushing unique_ptr and references through more APIs should help expose
the cases where ownership is a bit fuzzy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207263 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie
2014-04-25 20:00:34 +00:00
parent 172515f0be
commit 12d5224df6
6 changed files with 106 additions and 100 deletions

View File

@@ -367,7 +367,7 @@ class DwarfDebug : public AsmPrinterHandler {
DIE *constructScopeDIE(DwarfCompileUnit &TheCU, LexicalScope *Scope);
/// A helper function to create children of a Scope DIE.
DIE *createScopeChildrenDIE(DwarfCompileUnit &TheCU, LexicalScope *Scope,
SmallVectorImpl<DIE *> &Children);
SmallVectorImpl<std::unique_ptr<DIE>> &Children);
/// \brief Emit initial Dwarf sections with a label at the start of each one.
void emitSectionLabels();