diff options
author | Frederic Riss <friss@apple.com> | 2014-11-20 16:21:11 +0000 |
---|---|---|
committer | Frederic Riss <friss@apple.com> | 2014-11-20 16:21:11 +0000 |
commit | 77a0743216686f301ddbd5e2dcee075f8dea61a9 (patch) | |
tree | 62e7fa09aba9f0f47c37172a7a69d31211b735c9 /llvm/lib/DebugInfo/DWARFAcceleratorTable.cpp | |
parent | 7c41c64db76d4c21b0ff5a22817f40ec8a15317e (diff) | |
download | bcm5719-llvm-77a0743216686f301ddbd5e2dcee075f8dea61a9.tar.gz bcm5719-llvm-77a0743216686f301ddbd5e2dcee075f8dea61a9.zip |
Make DWARFAcceleratorTable::dump() const.
As dump() methods should be. To allow that, do not store the DWARFFormValue
objects used for the dump in the header data.
Per Alexey's suggestion!
llvm-svn: 222436
Diffstat (limited to 'llvm/lib/DebugInfo/DWARFAcceleratorTable.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/DWARFAcceleratorTable.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/llvm/lib/DebugInfo/DWARFAcceleratorTable.cpp b/llvm/lib/DebugInfo/DWARFAcceleratorTable.cpp index c0c0f7c0d1e..703274de492 100644 --- a/llvm/lib/DebugInfo/DWARFAcceleratorTable.cpp +++ b/llvm/lib/DebugInfo/DWARFAcceleratorTable.cpp @@ -40,14 +40,14 @@ bool DWARFAcceleratorTable::extract() { for (unsigned i = 0; i < NumAtoms; ++i) { uint16_t AtomType = AccelSection.getU16(&Offset); - DWARFFormValue AtomForm(AccelSection.getU16(&Offset)); + uint16_t AtomForm = AccelSection.getU16(&Offset); HdrData.Atoms.push_back(std::make_pair(AtomType, AtomForm)); } return true; } -void DWARFAcceleratorTable::dump(raw_ostream &OS) { +void DWARFAcceleratorTable::dump(raw_ostream &OS) const { // Dump the header. OS << "Magic = " << format("0x%08x", Hdr.Magic) << '\n' << "Version = " << format("0x%04x", Hdr.Version) << '\n' @@ -59,6 +59,7 @@ void DWARFAcceleratorTable::dump(raw_ostream &OS) { << "Number of atoms = " << HdrData.Atoms.size() << '\n'; unsigned i = 0; + SmallVector<DWARFFormValue, 3> AtomForms; for (const auto &Atom: HdrData.Atoms) { OS << format("Atom[%d] Type: ", i++); if (const char *TypeString = dwarf::AtomTypeString(Atom.first)) @@ -66,11 +67,12 @@ void DWARFAcceleratorTable::dump(raw_ostream &OS) { else OS << format("DW_ATOM_Unknown_0x%x", Atom.first); OS << " Form: "; - if (const char *FormString = dwarf::FormEncodingString(Atom.second.getForm())) + if (const char *FormString = dwarf::FormEncodingString(Atom.second)) OS << FormString; else - OS << format("DW_FORM_Unknown_0x%x", Atom.second.getForm()); + OS << format("DW_FORM_Unknown_0x%x", Atom.second); OS << '\n'; + AtomForms.push_back(DWARFFormValue(Atom.second)); } // Now go through the actual tables and dump them. @@ -114,10 +116,10 @@ void DWARFAcceleratorTable::dump(raw_ostream &OS) { for (unsigned Data = 0; Data < NumData; ++Data) { OS << format(" Data[%d] => ", Data); unsigned i = 0; - for (auto &Atom : HdrData.Atoms) { + for (auto &Atom : AtomForms) { OS << format("{Atom[%d]: ", i++); - if (Atom.second.extractValue(AccelSection, &DataOffset, nullptr)) - Atom.second.dump(OS, nullptr); + if (Atom.extractValue(AccelSection, &DataOffset, nullptr)) + Atom.dump(OS, nullptr); else OS << "Error extracting the value"; OS << "} "; |