diff options
author | Alexey Samsonov <samsonov@google.com> | 2014-03-14 14:22:49 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2014-03-14 14:22:49 +0000 |
commit | aa4d29571c832c1fc706f047e3ee099a133b179b (patch) | |
tree | 5c24ba4009faa1bd85f515783fc3861abadc7522 /llvm/tools/llvm-objdump/llvm-objdump.cpp | |
parent | 68627942069e29129a685fba09104cf32fbc8298 (diff) | |
download | bcm5719-llvm-aa4d29571c832c1fc706f047e3ee099a133b179b.tar.gz bcm5719-llvm-aa4d29571c832c1fc706f047e3ee099a133b179b.zip |
[C++11] Introduce SectionRef::relocations() to use range-based loops
Reviewers: rafael
Reviewed By: rafael
CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D3077
llvm-svn: 203927
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
-rw-r--r-- | llvm/tools/llvm-objdump/llvm-objdump.cpp | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp index 7fa01f7633e..9f6ea35eaf5 100644 --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -435,14 +435,10 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) { // Make a list of all the relocations for this section. std::vector<RelocationRef> Rels; if (InlineRelocs) { - SmallVectorImpl<SectionRef> *RelocSecs = &SectionRelocMap[Section]; - for (SmallVectorImpl<SectionRef>::iterator RelocSec = RelocSecs->begin(), - E = RelocSecs->end(); - RelocSec != E; ++RelocSec) { - for (relocation_iterator RI = RelocSec->relocation_begin(), - RE = RelocSec->relocation_end(); - RI != RE; ++RI) - Rels.push_back(*RI); + for (const SectionRef &RelocSec : SectionRelocMap[Section]) { + for (const RelocationRef &Reloc : RelocSec.relocations()) { + Rels.push_back(Reloc); + } } } @@ -560,18 +556,21 @@ static void PrintRelocations(const ObjectFile *Obj) { if (error(Section.getName(secname))) continue; outs() << "RELOCATION RECORDS FOR [" << secname << "]:\n"; - for (relocation_iterator ri = Section.relocation_begin(), - re = Section.relocation_end(); - ri != re; ++ri) { + for (const RelocationRef &Reloc : Section.relocations()) { bool hidden; uint64_t address; SmallString<32> relocname; SmallString<32> valuestr; - if (error(ri->getHidden(hidden))) continue; - if (hidden) continue; - if (error(ri->getTypeName(relocname))) continue; - if (error(ri->getOffset(address))) continue; - if (error(ri->getValueString(valuestr))) continue; + if (error(Reloc.getHidden(hidden))) + continue; + if (hidden) + continue; + if (error(Reloc.getTypeName(relocname))) + continue; + if (error(Reloc.getOffset(address))) + continue; + if (error(Reloc.getValueString(valuestr))) + continue; outs() << address << " " << relocname << " " << valuestr << "\n"; } outs() << "\n"; |