AsmPrinter: Change DIEValueList to a subclass of DIE, NFC

Rewrite `DIEValueList` as a subclass of `DIE`, renaming its API to match
`DIE`'s.  This is preparation for changing `DIEBlock` and `DIELoc` to
stop inheriting from `DIE` and inherit directly from `DIEValueList`.

I thought about leaving this as a has-a relationship (and changing
`DIELoc` and `DIEBlock` to also have-a `DIEValueList`), but that seemed
to require a fair bit more boilerplate and I think it needed more
changes to the `DwarfUnit` API than this will.

No functionality change intended here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243854 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith
2015-08-02 20:42:45 +00:00
parent 1e95eedbab
commit bc3c2c319c
2 changed files with 40 additions and 60 deletions

View File

@@ -109,7 +109,7 @@ void DIEAbbrev::dump() { print(dbgs()); }
DIEAbbrev DIE::generateAbbrev() const {
DIEAbbrev Abbrev(Tag, hasChildren());
for (const DIEValue &V : Values)
for (const DIEValue &V : values())
Abbrev.AddAttribute(V.getAttribute(), V.getForm());
return Abbrev;
}
@@ -166,7 +166,7 @@ void DIE::print(raw_ostream &O, unsigned IndentCount) const {
IndentCount += 2;
unsigned I = 0;
for (const auto &V : Values) {
for (const auto &V : values()) {
O << Indent;
if (!isBlock)
@@ -507,7 +507,7 @@ void DIETypeSignature::print(raw_ostream &O) const {
///
unsigned DIELoc::ComputeSize(const AsmPrinter *AP) const {
if (!Size) {
for (const auto &V : Values)
for (const auto &V : values())
Size += V.SizeOf(AP);
}
@@ -527,7 +527,7 @@ void DIELoc::EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const {
Asm->EmitULEB128(Size); break;
}
for (const auto &V : Values)
for (const auto &V : values())
V.EmitValue(Asm);
}
@@ -560,7 +560,7 @@ void DIELoc::print(raw_ostream &O) const {
///
unsigned DIEBlock::ComputeSize(const AsmPrinter *AP) const {
if (!Size) {
for (const auto &V : Values)
for (const auto &V : values())
Size += V.SizeOf(AP);
}
@@ -578,7 +578,7 @@ void DIEBlock::EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const {
case dwarf::DW_FORM_block: Asm->EmitULEB128(Size); break;
}
for (const auto &V : Values)
for (const auto &V : values())
V.EmitValue(Asm);
}