diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-05-27 22:59:03 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-05-27 22:59:03 +0000 |
commit | 6289892c20a3c3c80c3c25ed303f9abb9758d421 (patch) | |
tree | ec39454442c8a8bb12b83c43c609c65028a21973 /llvm | |
parent | ca706e54a9a76cd2c26959c537bb90aa40514435 (diff) | |
download | bcm5719-llvm-6289892c20a3c3c80c3c25ed303f9abb9758d421.tar.gz bcm5719-llvm-6289892c20a3c3c80c3c25ed303f9abb9758d421.zip |
AsmPrinter: Return added DIE from DIE::addChild()
Change `DIE::addChild()` to return a reference to the just-added node,
and update consumers to use it directly. An upcoming commit will
abstract away (and eventually change) the underlying storage of
`DIE::Children`.
llvm-svn: 238372
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/include/llvm/CodeGen/DIE.h | 3 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp | 3 |
2 files changed, 3 insertions, 3 deletions
diff --git a/llvm/include/llvm/CodeGen/DIE.h b/llvm/include/llvm/CodeGen/DIE.h index 5a8f4915f5e..c843f3fd1a6 100644 --- a/llvm/include/llvm/CodeGen/DIE.h +++ b/llvm/include/llvm/CodeGen/DIE.h @@ -543,10 +543,11 @@ public: /// addChild - Add a child to the DIE. /// - void addChild(std::unique_ptr<DIE> Child) { + DIE &addChild(std::unique_ptr<DIE> Child) { assert(!Child->getParent()); Child->Parent = this; Children.push_back(std::move(Child)); + return *Children.back(); } /// Find a value in the DIE with the attribute given. diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index fc57f261188..907f6706bc6 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -290,8 +290,7 @@ void DwarfUnit::addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE &DwarfUnit::createAndAddDIE(unsigned Tag, DIE &Parent, const DINode *N) { assert(Tag != dwarf::DW_TAG_auto_variable && Tag != dwarf::DW_TAG_arg_variable); - Parent.addChild(make_unique<DIE>((dwarf::Tag)Tag)); - DIE &Die = *Parent.getChildren().back(); + DIE &Die = Parent.addChild(make_unique<DIE>((dwarf::Tag)Tag)); if (N) insertDIE(N, &Die); return Die; |