diff options
author | Alexey Samsonov <samsonov@google.com> | 2014-03-18 06:53:02 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2014-03-18 06:53:02 +0000 |
commit | 27dc839406ae7b25e91ab1dafa1b06d1b9d0a6ee (patch) | |
tree | 6483b683d79e060efa7312aefa39fed4f0cfdf9b /llvm/lib/Object/COFFObjectFile.cpp | |
parent | eac8cc7a42c5469a9af154b10f0fc19e57744656 (diff) | |
download | bcm5719-llvm-27dc839406ae7b25e91ab1dafa1b06d1b9d0a6ee.tar.gz bcm5719-llvm-27dc839406ae7b25e91ab1dafa1b06d1b9d0a6ee.zip |
[C++11] Change the interface of getCOFF{Section,Relocation,Symbol} to make it work with range-based for loops.
Reviewers: ruiu
Reviewed By: ruiu
CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D3097
llvm-svn: 204120
Diffstat (limited to 'llvm/lib/Object/COFFObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/COFFObjectFile.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp index 461dbac1168..7f66c6a29c8 100644 --- a/llvm/lib/Object/COFFObjectFile.cpp +++ b/llvm/lib/Object/COFFObjectFile.cpp @@ -431,9 +431,8 @@ error_code COFFObjectFile::getVaPtr(uint64_t Addr, uintptr_t &Res) const { // Returns the file offset for the given RVA. error_code COFFObjectFile::getRvaPtr(uint32_t Addr, uintptr_t &Res) const { - for (section_iterator I = section_begin(), E = section_end(); I != E; - ++I) { - const coff_section *Section = getCOFFSection(I); + for (const SectionRef &S : sections()) { + const coff_section *Section = getCOFFSection(S); uint32_t SectionStart = Section->VirtualAddress; uint32_t SectionEnd = Section->VirtualAddress + Section->VirtualSize; if (SectionStart <= Addr && Addr < SectionEnd) { @@ -872,21 +871,25 @@ error_code COFFObjectFile::getRelocationType(DataRefImpl Rel, return object_error::success; } -const coff_section *COFFObjectFile::getCOFFSection(section_iterator &It) const { - return toSec(It->getRawDataRefImpl()); +const coff_section * +COFFObjectFile::getCOFFSection(const SectionRef &Section) const { + return toSec(Section.getRawDataRefImpl()); } -const coff_symbol *COFFObjectFile::getCOFFSymbol(symbol_iterator &It) const { - return toSymb(It->getRawDataRefImpl()); +const coff_symbol * +COFFObjectFile::getCOFFSymbol(const SymbolRef &Symbol) const { + return toSymb(Symbol.getRawDataRefImpl()); } const coff_relocation * -COFFObjectFile::getCOFFRelocation(relocation_iterator &It) const { - return toRel(It->getRawDataRefImpl()); +COFFObjectFile::getCOFFRelocation(const RelocationRef &Reloc) const { + return toRel(Reloc.getRawDataRefImpl()); } -#define LLVM_COFF_SWITCH_RELOC_TYPE_NAME(enum) \ - case COFF::enum: Res = #enum; break; +#define LLVM_COFF_SWITCH_RELOC_TYPE_NAME(reloc_type) \ + case COFF::reloc_type: \ + Res = #reloc_type; \ + break; error_code COFFObjectFile::getRelocationTypeName(DataRefImpl Rel, SmallVectorImpl<char> &Result) const { |