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 | 5b645797db05926bffdd6214e94a527267445cc9 (patch) | |
tree | 654d72ff2ee5049fd99780d13934c64cb1bd76bf /lib/Object | |
parent | 3bdef4b6dc8098d86c74c445c8478c28598a3a05 (diff) | |
download | llvm-5b645797db05926bffdd6214e94a527267445cc9.tar.gz llvm-5b645797db05926bffdd6214e94a527267445cc9.tar.bz2 llvm-5b645797db05926bffdd6214e94a527267445cc9.tar.xz |
[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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204120 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Object')
-rw-r--r-- | lib/Object/COFFObjectFile.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/lib/Object/COFFObjectFile.cpp b/lib/Object/COFFObjectFile.cpp index 461dbac116..7f66c6a29c 100644 --- a/lib/Object/COFFObjectFile.cpp +++ b/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 { |