mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user