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:
David Blaikie
2014-04-14 22:45:02 +00:00
parent fdf3f439eb
commit 40352669ba
5 changed files with 31 additions and 43 deletions

View File

@@ -463,20 +463,18 @@ void DIEHash::computeHash(const DIE &Die) {
addAttributes(Die);
// Then hash each of the children of the DIE.
for (std::vector<DIE *>::const_iterator I = Die.getChildren().begin(),
E = Die.getChildren().end();
I != E; ++I) {
for (auto &C : Die.getChildren()) {
// 7.27 Step 7
// If C is a nested type entry or a member function entry, ...
if (isType((*I)->getTag()) || (*I)->getTag() == dwarf::DW_TAG_subprogram) {
StringRef Name = getDIEStringAttr(**I, dwarf::DW_AT_name);
if (isType(C->getTag()) || C->getTag() == dwarf::DW_TAG_subprogram) {
StringRef Name = getDIEStringAttr(*C, dwarf::DW_AT_name);
// ... and has a DW_AT_name attribute
if (!Name.empty()) {
hashNestedType(**I, Name);
hashNestedType(*C, Name);
continue;
}
}
computeHash(**I);
computeHash(*C);
}
// Following the last (or if there are no children), append a zero byte.