diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-04-14 22:45:02 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-04-14 22:45:02 +0000 |
commit | 40352669ba5a42c22395abf03e289c4f2ee9ec47 (patch) | |
tree | 83ebabbbfa5cd80018f0e3fcb2a34dfe1e0fdd84 /lib/CodeGen/AsmPrinter/DIE.h | |
parent | fdf3f439ebd999c6f7084fde89ccad503ea7b3f9 (diff) | |
download | llvm-40352669ba5a42c22395abf03e289c4f2ee9ec47.tar.gz llvm-40352669ba5a42c22395abf03e289c4f2ee9ec47.tar.bz2 llvm-40352669ba5a42c22395abf03e289c4f2ee9ec47.tar.xz |
Use std::unique_ptr for DIE children
Got bored, removed some manual memory management.
Pushed references (rather than pointers) through a few APIs rather than
replacing *x with x.get().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206222 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DIE.h')
-rw-r--r-- | lib/CodeGen/AsmPrinter/DIE.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/CodeGen/AsmPrinter/DIE.h b/lib/CodeGen/AsmPrinter/DIE.h index e26c525a9e..3876728307 100644 --- a/lib/CodeGen/AsmPrinter/DIE.h +++ b/lib/CodeGen/AsmPrinter/DIE.h @@ -124,7 +124,7 @@ protected: /// Children DIEs. /// - std::vector<DIE *> Children; + std::vector<std::unique_ptr<DIE>> Children; DIE *Parent; @@ -141,7 +141,6 @@ public: explicit DIE(dwarf::Tag Tag) : Offset(0), Size(0), Abbrev((dwarf::Tag)Tag, dwarf::DW_CHILDREN_no), Parent(0) {} - ~DIE(); // Accessors. DIEAbbrev &getAbbrev() { return Abbrev; } @@ -150,7 +149,9 @@ public: dwarf::Tag getTag() const { return Abbrev.getTag(); } unsigned getOffset() const { return Offset; } unsigned getSize() const { return Size; } - const std::vector<DIE *> &getChildren() const { return Children; } + const std::vector<std::unique_ptr<DIE>> &getChildren() const { + return Children; + } const SmallVectorImpl<DIEValue *> &getValues() const { return Values; } DIE *getParent() const { return Parent; } /// Climb up the parent chain to get the compile or type unit DIE this DIE @@ -174,7 +175,7 @@ public: void addChild(DIE *Child) { assert(!Child->getParent()); Abbrev.setChildrenFlag(dwarf::DW_CHILDREN_yes); - Children.push_back(Child); + Children.push_back(std::unique_ptr<DIE>(Child)); Child->Parent = this; } |