diff --git a/include/llvm/Object/COFF.h b/include/llvm/Object/COFF.h index 5d99508f57f..264a851e853 100644 --- a/include/llvm/Object/COFF.h +++ b/include/llvm/Object/COFF.h @@ -332,12 +332,12 @@ protected: public: COFFObjectFile(MemoryBuffer *Object, error_code &EC, bool BufferOwned = true); - symbol_iterator begin_symbols() const LLVM_OVERRIDE; - symbol_iterator end_symbols() const LLVM_OVERRIDE; - library_iterator begin_libraries_needed() const LLVM_OVERRIDE; - library_iterator end_libraries_needed() const LLVM_OVERRIDE; - section_iterator begin_sections() const LLVM_OVERRIDE; - section_iterator end_sections() const LLVM_OVERRIDE; + symbol_iterator symbol_begin() const LLVM_OVERRIDE; + symbol_iterator symbol_end() const LLVM_OVERRIDE; + library_iterator needed_library_begin() const LLVM_OVERRIDE; + library_iterator needed_library_end() const LLVM_OVERRIDE; + section_iterator section_begin() const LLVM_OVERRIDE; + section_iterator section_end() const LLVM_OVERRIDE; const coff_section *getCOFFSection(section_iterator &It) const; const coff_symbol *getCOFFSymbol(symbol_iterator &It) const; diff --git a/include/llvm/Object/ELFObjectFile.h b/include/llvm/Object/ELFObjectFile.h index fe63277830b..054d8d4b65e 100644 --- a/include/llvm/Object/ELFObjectFile.h +++ b/include/llvm/Object/ELFObjectFile.h @@ -180,17 +180,17 @@ public: const Elf_Sym *getSymbol(DataRefImpl Symb) const; - symbol_iterator begin_symbols() const LLVM_OVERRIDE; - symbol_iterator end_symbols() const LLVM_OVERRIDE; + symbol_iterator symbol_begin() const LLVM_OVERRIDE; + symbol_iterator symbol_end() const LLVM_OVERRIDE; - symbol_iterator begin_dynamic_symbols() const; - symbol_iterator end_dynamic_symbols() const; + symbol_iterator dynamic_symbol_begin() const; + symbol_iterator dynamic_symbol_end() const; - section_iterator begin_sections() const LLVM_OVERRIDE; - section_iterator end_sections() const LLVM_OVERRIDE; + section_iterator section_begin() const LLVM_OVERRIDE; + section_iterator section_end() const LLVM_OVERRIDE; - library_iterator begin_libraries_needed() const LLVM_OVERRIDE; - library_iterator end_libraries_needed() const LLVM_OVERRIDE; + library_iterator needed_library_begin() const LLVM_OVERRIDE; + library_iterator needed_library_end() const LLVM_OVERRIDE; error_code getRelocationAddend(DataRefImpl Rel, int64_t &Res) const; error_code getSymbolVersion(SymbolRef Symb, StringRef &Version, @@ -413,7 +413,7 @@ error_code ELFObjectFile::getSymbolSection(DataRefImpl Symb, const Elf_Sym *ESym = getSymbol(Symb); const Elf_Shdr *ESec = EF.getSection(ESym); if (!ESec) - Res = end_sections(); + Res = section_end(); else { DataRefImpl Sec; Sec.p = reinterpret_cast(ESec); @@ -571,12 +571,12 @@ template section_iterator ELFObjectFile::getRelocatedSection(DataRefImpl Sec) const { if (EF.getHeader()->e_type != ELF::ET_REL) - return end_sections(); + return section_end(); Elf_Shdr_Iter EShdr = toELFShdrIter(Sec); uintX_t Type = EShdr->sh_type; if (Type != ELF::SHT_REL && Type != ELF::SHT_RELA) - return end_sections(); + return section_end(); const Elf_Shdr *R = EF.getSection(EShdr->sh_info); return section_iterator(SectionRef(toDRI(R), this)); @@ -606,7 +606,7 @@ ELFObjectFile::getRelocationSymbol(DataRefImpl Rel) const { } } if (!symbolIdx) - return end_symbols(); + return symbol_end(); const Elf_Shdr *SymSec = EF.getSection(sec->sh_link); @@ -824,32 +824,32 @@ ELFObjectFile::ELFObjectFile(MemoryBuffer *Object, error_code &ec, EF(Object, ec) {} template -symbol_iterator ELFObjectFile::begin_symbols() const { +symbol_iterator ELFObjectFile::symbol_begin() const { return symbol_iterator(SymbolRef(toDRI(EF.begin_symbols()), this)); } template -symbol_iterator ELFObjectFile::end_symbols() const { +symbol_iterator ELFObjectFile::symbol_end() const { return symbol_iterator(SymbolRef(toDRI(EF.end_symbols()), this)); } template -symbol_iterator ELFObjectFile::begin_dynamic_symbols() const { +symbol_iterator ELFObjectFile::dynamic_symbol_begin() const { return symbol_iterator(SymbolRef(toDRI(EF.begin_dynamic_symbols()), this)); } template -symbol_iterator ELFObjectFile::end_dynamic_symbols() const { +symbol_iterator ELFObjectFile::dynamic_symbol_end() const { return symbol_iterator(SymbolRef(toDRI(EF.end_dynamic_symbols()), this)); } template -section_iterator ELFObjectFile::begin_sections() const { +section_iterator ELFObjectFile::section_begin() const { return section_iterator(SectionRef(toDRI(EF.begin_sections()), this)); } template -section_iterator ELFObjectFile::end_sections() const { +section_iterator ELFObjectFile::section_end() const { return section_iterator(SectionRef(toDRI(EF.end_sections()), this)); } @@ -867,7 +867,7 @@ StringRef ELFObjectFile::getLoadName() const { } template -library_iterator ELFObjectFile::begin_libraries_needed() const { +library_iterator ELFObjectFile::needed_library_begin() const { Elf_Dyn_Iter DI = EF.begin_dynamic_table(); Elf_Dyn_Iter DE = EF.end_dynamic_table(); @@ -900,7 +900,7 @@ error_code ELFObjectFile::getLibraryPath(DataRefImpl Data, } template -library_iterator ELFObjectFile::end_libraries_needed() const { +library_iterator ELFObjectFile::needed_library_end() const { return library_iterator(LibraryRef(toDRI(EF.end_dynamic_table()), this)); } diff --git a/include/llvm/Object/MachO.h b/include/llvm/Object/MachO.h index 44217fc54f9..50cdfc38394 100644 --- a/include/llvm/Object/MachO.h +++ b/include/llvm/Object/MachO.h @@ -126,14 +126,14 @@ public: // TODO: Would be useful to have an iterator based version // of the load command interface too. - symbol_iterator begin_symbols() const LLVM_OVERRIDE; - symbol_iterator end_symbols() const LLVM_OVERRIDE; + symbol_iterator symbol_begin() const LLVM_OVERRIDE; + symbol_iterator symbol_end() const LLVM_OVERRIDE; - section_iterator begin_sections() const LLVM_OVERRIDE; - section_iterator end_sections() const LLVM_OVERRIDE; + section_iterator section_begin() const LLVM_OVERRIDE; + section_iterator section_end() const LLVM_OVERRIDE; - library_iterator begin_libraries_needed() const LLVM_OVERRIDE; - library_iterator end_libraries_needed() const LLVM_OVERRIDE; + library_iterator needed_library_begin() const LLVM_OVERRIDE; + library_iterator needed_library_end() const LLVM_OVERRIDE; uint8_t getBytesInAddress() const LLVM_OVERRIDE; diff --git a/include/llvm/Object/ObjectFile.h b/include/llvm/Object/ObjectFile.h index 3fac0e96460..786f8031876 100644 --- a/include/llvm/Object/ObjectFile.h +++ b/include/llvm/Object/ObjectFile.h @@ -163,8 +163,8 @@ public: error_code containsSymbol(SymbolRef S, bool &Result) const; - relocation_iterator begin_relocations() const; - relocation_iterator end_relocations() const; + relocation_iterator relocation_begin() const; + relocation_iterator relocation_end() const; section_iterator getRelocatedSection() const; DataRefImpl getRawDataRefImpl() const; @@ -342,14 +342,14 @@ protected: public: - virtual symbol_iterator begin_symbols() const = 0; - virtual symbol_iterator end_symbols() const = 0; + virtual symbol_iterator symbol_begin() const = 0; + virtual symbol_iterator symbol_end() const = 0; - virtual section_iterator begin_sections() const = 0; - virtual section_iterator end_sections() const = 0; + virtual section_iterator section_begin() const = 0; + virtual section_iterator section_end() const = 0; - virtual library_iterator begin_libraries_needed() const = 0; - virtual library_iterator end_libraries_needed() const = 0; + virtual library_iterator needed_library_begin() const = 0; + virtual library_iterator needed_library_end() const = 0; /// @brief The number of bytes used to represent an address in this object /// file format. @@ -518,11 +518,11 @@ inline error_code SectionRef::containsSymbol(SymbolRef S, bool &Result) const { Result); } -inline relocation_iterator SectionRef::begin_relocations() const { +inline relocation_iterator SectionRef::relocation_begin() const { return OwningObject->section_rel_begin(SectionPimpl); } -inline relocation_iterator SectionRef::end_relocations() const { +inline relocation_iterator SectionRef::relocation_end() const { return OwningObject->section_rel_end(SectionPimpl); } diff --git a/lib/DebugInfo/DWARFContext.cpp b/lib/DebugInfo/DWARFContext.cpp index daf7cdd98c6..b5b75b0408e 100644 --- a/lib/DebugInfo/DWARFContext.cpp +++ b/lib/DebugInfo/DWARFContext.cpp @@ -603,8 +603,8 @@ static bool consumeCompressedDebugSectionHeader(StringRef &data, DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj) : IsLittleEndian(Obj->isLittleEndian()), AddressSize(Obj->getBytesInAddress()) { - for (object::section_iterator i = Obj->begin_sections(), - e = Obj->end_sections(); + for (object::section_iterator i = Obj->section_begin(), + e = Obj->section_end(); i != e; ++i) { StringRef name; i->getName(name); @@ -665,7 +665,7 @@ DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj) : } section_iterator RelocatedSection = i->getRelocatedSection(); - if (RelocatedSection == Obj->end_sections()) + if (RelocatedSection == Obj->section_end()) continue; StringRef RelSecName; @@ -692,11 +692,11 @@ DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj) : continue; } - if (i->begin_relocations() != i->end_relocations()) { + if (i->relocation_begin() != i->relocation_end()) { uint64_t SectionSize; RelocatedSection->getSize(SectionSize); - for (object::relocation_iterator reloc_i = i->begin_relocations(), - reloc_e = i->end_relocations(); + for (object::relocation_iterator reloc_i = i->relocation_begin(), + reloc_e = i->relocation_end(); reloc_i != reloc_e; ++reloc_i) { uint64_t Address; reloc_i->getOffset(Address); diff --git a/lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h b/lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h index 2056f39b5ac..f647b87f591 100644 --- a/lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h +++ b/lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h @@ -52,14 +52,14 @@ public: virtual ~ObjectImageCommon() { delete ObjFile; } virtual object::symbol_iterator begin_symbols() const - { return ObjFile->begin_symbols(); } + { return ObjFile->symbol_begin(); } virtual object::symbol_iterator end_symbols() const - { return ObjFile->end_symbols(); } + { return ObjFile->symbol_end(); } virtual object::section_iterator begin_sections() const - { return ObjFile->begin_sections(); } + { return ObjFile->section_begin(); } virtual object::section_iterator end_sections() const - { return ObjFile->end_sections(); } + { return ObjFile->section_end(); } virtual /* Triple::ArchType */ unsigned getArch() const { return ObjFile->getArch(); } diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp index 8ea941b69dc..b858965b5c2 100644 --- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp +++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp @@ -177,8 +177,8 @@ ObjectImage *RuntimeDyldImpl::loadObject(ObjectImage *InputObject) { StubMap Stubs; section_iterator RelocatedSection = si->getRelocatedSection(); - for (relocation_iterator i = si->begin_relocations(), - e = si->end_relocations(); + for (relocation_iterator i = si->relocation_begin(), + e = si->relocation_end(); i != e; ++i) { // If it's the first relocation in this section, find its SectionID if (isFirstRelocation) { @@ -251,15 +251,15 @@ unsigned RuntimeDyldImpl::emitSection(ObjectImage &Obj, // necessary section allocation size in loadObject by walking all the sections // once. if (StubSize > 0) { - for (section_iterator SI = ObjFile->begin_sections(), - SE = ObjFile->end_sections(); + for (section_iterator SI = ObjFile->section_begin(), + SE = ObjFile->section_end(); SI != SE; ++SI) { section_iterator RelSecI = SI->getRelocatedSection(); if (!(RelSecI == Section)) continue; - for (relocation_iterator I = SI->begin_relocations(), - E = SI->end_relocations(); + for (relocation_iterator I = SI->relocation_begin(), + E = SI->relocation_end(); I != E; ++I) { StubBufSize += StubSize; } diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp index 4dbd6794c61..a4246e0c71e 100644 --- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp +++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp @@ -632,8 +632,8 @@ void RuntimeDyldELF::findOPDEntrySection(ObjectImage &Obj, if (RelSectionName != ".opd") continue; - for (relocation_iterator i = si->begin_relocations(), - e = si->end_relocations(); i != e;) { + for (relocation_iterator i = si->relocation_begin(), + e = si->relocation_end(); i != e;) { // The R_PPC64_ADDR64 relocation indicates the first field // of a .opd entry uint64_t TypeFunc; diff --git a/lib/MC/MCObjectDisassembler.cpp b/lib/MC/MCObjectDisassembler.cpp index 85de4111b7f..5851bdfdb71 100644 --- a/lib/MC/MCObjectDisassembler.cpp +++ b/lib/MC/MCObjectDisassembler.cpp @@ -37,7 +37,7 @@ MCObjectDisassembler::MCObjectDisassembler(const ObjectFile &Obj, : Obj(Obj), Dis(Dis), MIA(MIA), MOS(0) {} uint64_t MCObjectDisassembler::getEntrypoint() { - for (symbol_iterator SI = Obj.begin_symbols(), SE = Obj.end_symbols(); + for (symbol_iterator SI = Obj.symbol_begin(), SE = Obj.symbol_end(); SI != SE; ++SI) { StringRef Name; SI->getName(Name); @@ -87,7 +87,7 @@ MCModule *MCObjectDisassembler::buildModule(bool withCFG) { } void MCObjectDisassembler::buildSectionAtoms(MCModule *Module) { - for (section_iterator SI = Obj.begin_sections(), SE = Obj.end_sections(); + for (section_iterator SI = Obj.section_begin(), SE = Obj.section_end(); SI != SE; ++SI) { bool isText; SI->isText(isText); bool isData; SI->isData(isData); @@ -176,7 +176,7 @@ void MCObjectDisassembler::buildCFG(MCModule *Module) { AddressSetTy Splits; AddressSetTy Calls; - for (symbol_iterator SI = Obj.begin_symbols(), SE = Obj.end_symbols(); + for (symbol_iterator SI = Obj.symbol_begin(), SE = Obj.symbol_end(); SI != SE; ++SI) { SymbolRef::Type SymType; SI->getType(SymType); @@ -495,7 +495,7 @@ MCMachOObjectDisassembler::MCMachOObjectDisassembler( : MCObjectDisassembler(MOOF, Dis, MIA), MOOF(MOOF), VMAddrSlide(VMAddrSlide), HeaderLoadAddress(HeaderLoadAddress) { - for (section_iterator SI = MOOF.begin_sections(), SE = MOOF.end_sections(); + for (section_iterator SI = MOOF.section_begin(), SE = MOOF.section_end(); SI != SE; ++SI) { StringRef Name; SI->getName(Name); diff --git a/lib/MC/MCObjectSymbolizer.cpp b/lib/MC/MCObjectSymbolizer.cpp index 3fb053dd789..ee0b81ed15f 100644 --- a/lib/MC/MCObjectSymbolizer.cpp +++ b/lib/MC/MCObjectSymbolizer.cpp @@ -52,7 +52,7 @@ MCMachObjectSymbolizer(MCContext &Ctx, OwningPtr &RelInfo, : MCObjectSymbolizer(Ctx, RelInfo, MOOF), MOOF(MOOF), StubsStart(0), StubsCount(0), StubSize(0), StubsIndSymIndex(0) { - for (section_iterator SI = MOOF->begin_sections(), SE = MOOF->end_sections(); + for (section_iterator SI = MOOF->section_begin(), SE = MOOF->section_end(); SI != SE; ++SI) { StringRef Name; SI->getName(Name); if (Name == "__stubs") { @@ -88,11 +88,11 @@ StringRef MCMachObjectSymbolizer::findExternalFunctionAt(uint64_t Addr) { MOOF->getIndirectSymbolTableEntry(MOOF->getDysymtabLoadCommand(), StubIdx); StringRef SymName; - symbol_iterator SI = MOOF->begin_symbols(); + symbol_iterator SI = MOOF->symbol_begin(); for (uint32_t i = 0; i != SymtabIdx; ++i) ++SI; SI->getName(SymName); - assert(SI != MOOF->end_symbols() && "Stub wasn't found in the symbol table!"); + assert(SI != MOOF->symbol_end() && "Stub wasn't found in the symbol table!"); assert(SymName.front() == '_' && "Mach-O symbol doesn't start with '_'!"); return SymName.substr(1); } @@ -155,7 +155,7 @@ tryAddingSymbolicOperand(MCInst &MI, raw_ostream &cStream, return false; uint64_t UValue = Value; // FIXME: map instead of looping each time? - for (symbol_iterator SI = Obj->begin_symbols(), SE = Obj->end_symbols(); + for (symbol_iterator SI = Obj->symbol_begin(), SE = Obj->symbol_end(); SI != SE; ++SI) { uint64_t SymAddr; SI->getAddress(SymAddr); uint64_t SymSize; SI->getSize(SymSize); @@ -233,7 +233,7 @@ const RelocationRef *MCObjectSymbolizer::findRelocationAt(uint64_t Addr) { } void MCObjectSymbolizer::buildSectionList() { - for (section_iterator SI = Obj->begin_sections(), SE = Obj->end_sections(); + for (section_iterator SI = Obj->section_begin(), SE = Obj->section_end(); SI != SE; ++SI) { bool RequiredForExec; SI->isRequiredForExecution(RequiredForExec); if (RequiredForExec == false) @@ -254,10 +254,10 @@ void MCObjectSymbolizer::buildSectionList() { } void MCObjectSymbolizer::buildRelocationByAddrMap() { - for (section_iterator SI = Obj->begin_sections(), SE = Obj->end_sections(); + for (section_iterator SI = Obj->section_begin(), SE = Obj->section_end(); SI != SE; ++SI) { section_iterator RelSecI = SI->getRelocatedSection(); - if (RelSecI == Obj->end_sections()) + if (RelSecI == Obj->section_end()) continue; uint64_t StartAddr; RelSecI->getAddress(StartAddr); @@ -265,8 +265,8 @@ void MCObjectSymbolizer::buildRelocationByAddrMap() { bool RequiredForExec; RelSecI->isRequiredForExecution(RequiredForExec); if (RequiredForExec == false || Size == 0) continue; - for (relocation_iterator RI = SI->begin_relocations(), - RE = SI->end_relocations(); + for (relocation_iterator RI = SI->relocation_begin(), + RE = SI->relocation_end(); RI != RE; ++RI) { // FIXME: libObject is inconsistent regarding error handling. The // overwhelming majority of methods always return object_error::success, diff --git a/lib/Object/COFFObjectFile.cpp b/lib/Object/COFFObjectFile.cpp index a604acda749..a1bbc56d2be 100644 --- a/lib/Object/COFFObjectFile.cpp +++ b/lib/Object/COFFObjectFile.cpp @@ -205,7 +205,7 @@ error_code COFFObjectFile::getSymbolSection(DataRefImpl Ref, section_iterator &Result) const { const coff_symbol *Symb = toSymb(Ref); if (Symb->SectionNumber <= COFF::IMAGE_SYM_UNDEFINED) - Result = end_sections(); + Result = section_end(); else { const coff_section *Sec = 0; if (error_code EC = getSection(Symb->SectionNumber, Sec)) return EC; @@ -383,7 +383,7 @@ error_code COFFObjectFile::initSymbolTablePtr() { // Returns the file offset for the given RVA. error_code COFFObjectFile::getRvaPtr(uint32_t Rva, uintptr_t &Res) const { - for (section_iterator I = begin_sections(), E = end_sections(); I != E; + for (section_iterator I = section_begin(), E = section_end(); I != E; ++I) { const coff_section *Section = getCOFFSection(I); uint32_t SectionStart = Section->VirtualAddress; @@ -540,25 +540,25 @@ COFFObjectFile::COFFObjectFile(MemoryBuffer *Object, error_code &EC, EC = object_error::success; } -symbol_iterator COFFObjectFile::begin_symbols() const { +symbol_iterator COFFObjectFile::symbol_begin() const { DataRefImpl Ret; Ret.p = reinterpret_cast(SymbolTable); return symbol_iterator(SymbolRef(Ret, this)); } -symbol_iterator COFFObjectFile::end_symbols() const { +symbol_iterator COFFObjectFile::symbol_end() const { // The symbol table ends where the string table begins. DataRefImpl Ret; Ret.p = reinterpret_cast(StringTable); return symbol_iterator(SymbolRef(Ret, this)); } -library_iterator COFFObjectFile::begin_libraries_needed() const { +library_iterator COFFObjectFile::needed_library_begin() const { // TODO: implement report_fatal_error("Libraries needed unimplemented in COFFObjectFile"); } -library_iterator COFFObjectFile::end_libraries_needed() const { +library_iterator COFFObjectFile::needed_library_end() const { // TODO: implement report_fatal_error("Libraries needed unimplemented in COFFObjectFile"); } @@ -591,13 +591,13 @@ export_directory_iterator COFFObjectFile::export_directory_end() const { return export_directory_iterator(Ref); } -section_iterator COFFObjectFile::begin_sections() const { +section_iterator COFFObjectFile::section_begin() const { DataRefImpl Ret; Ret.p = reinterpret_cast(SectionTable); return section_iterator(SectionRef(Ret, this)); } -section_iterator COFFObjectFile::end_sections() const { +section_iterator COFFObjectFile::section_end() const { DataRefImpl Ret; int NumSections = COFFHeader->isImportLibrary() ? 0 : COFFHeader->NumberOfSections; diff --git a/lib/Object/MachOObjectFile.cpp b/lib/Object/MachOObjectFile.cpp index 3dd837c6e79..23c2d6d8bda 100644 --- a/lib/Object/MachOObjectFile.cpp +++ b/lib/Object/MachOObjectFile.cpp @@ -296,7 +296,7 @@ static void printRelocationTargetName(const MachOObjectFile *O, if (IsScattered) { uint32_t Val = O->getPlainRelocationSymbolNum(RE); - for (symbol_iterator SI = O->begin_symbols(), SE = O->end_symbols(); + for (symbol_iterator SI = O->symbol_begin(), SE = O->symbol_end(); SI != SE; ++SI) { error_code ec; uint64_t Addr; @@ -313,7 +313,7 @@ static void printRelocationTargetName(const MachOObjectFile *O, // If we couldn't find a symbol that this relocation refers to, try // to find a section beginning instead. - for (section_iterator SI = O->begin_sections(), SE = O->end_sections(); + for (section_iterator SI = O->section_begin(), SE = O->section_end(); SI != SE; ++SI) { error_code ec; uint64_t Addr; @@ -337,11 +337,11 @@ static void printRelocationTargetName(const MachOObjectFile *O, uint64_t Val = O->getPlainRelocationSymbolNum(RE); if (isExtern) { - symbol_iterator SI = O->begin_symbols(); + symbol_iterator SI = O->symbol_begin(); advance(SI, Val); SI->getName(S); } else { - section_iterator SI = O->begin_sections(); + section_iterator SI = O->section_begin(); // Adjust for the fact that sections are 1-indexed. advance(SI, Val - 1); SI->getName(S); @@ -528,7 +528,7 @@ error_code MachOObjectFile::getSymbolSize(DataRefImpl DRI, } // Unfortunately symbols are unsorted so we need to touch all // symbols from load command - for (symbol_iterator I = begin_symbols(), E = end_symbols(); I != E; ++I) { + for (symbol_iterator I = symbol_begin(), E = symbol_end(); I != E; ++I) { DataRefImpl DRI = I->getRawDataRefImpl(); Entry = getSymbolTableEntryBase(this, DRI); getSymbolAddress(DRI, Value); @@ -612,7 +612,7 @@ MachOObjectFile::getSymbolSection(DataRefImpl Symb, uint8_t index = Entry.n_sect; if (index == 0) { - Res = end_sections(); + Res = section_end(); } else { DataRefImpl DRI; DRI.d.a = index - 1; @@ -834,7 +834,7 @@ MachOObjectFile::getRelocationSymbol(DataRefImpl Rel) const { uint32_t SymbolIdx = getPlainRelocationSymbolNum(RE); bool isExtern = getPlainRelocationExternal(RE); if (!isExtern) - return end_symbols(); + return symbol_end(); MachO::symtab_command S = getSymtabLoadCommand(); unsigned SymbolTableEntrySize = is64Bit() ? @@ -1163,7 +1163,7 @@ error_code MachOObjectFile::getLibraryPath(DataRefImpl LibData, report_fatal_error("Needed libraries unimplemented in MachOObjectFile"); } -symbol_iterator MachOObjectFile::begin_symbols() const { +symbol_iterator MachOObjectFile::symbol_begin() const { DataRefImpl DRI; if (!SymtabLoadCmd) return symbol_iterator(SymbolRef(DRI, this)); @@ -1173,7 +1173,7 @@ symbol_iterator MachOObjectFile::begin_symbols() const { return symbol_iterator(SymbolRef(DRI, this)); } -symbol_iterator MachOObjectFile::end_symbols() const { +symbol_iterator MachOObjectFile::symbol_end() const { DataRefImpl DRI; if (!SymtabLoadCmd) return symbol_iterator(SymbolRef(DRI, this)); @@ -1188,23 +1188,23 @@ symbol_iterator MachOObjectFile::end_symbols() const { return symbol_iterator(SymbolRef(DRI, this)); } -section_iterator MachOObjectFile::begin_sections() const { +section_iterator MachOObjectFile::section_begin() const { DataRefImpl DRI; return section_iterator(SectionRef(DRI, this)); } -section_iterator MachOObjectFile::end_sections() const { +section_iterator MachOObjectFile::section_end() const { DataRefImpl DRI; DRI.d.a = Sections.size(); return section_iterator(SectionRef(DRI, this)); } -library_iterator MachOObjectFile::begin_libraries_needed() const { +library_iterator MachOObjectFile::needed_library_begin() const { // TODO: implement report_fatal_error("Needed libraries unimplemented in MachOObjectFile"); } -library_iterator MachOObjectFile::end_libraries_needed() const { +library_iterator MachOObjectFile::needed_library_end() const { // TODO: implement report_fatal_error("Needed libraries unimplemented in MachOObjectFile"); } @@ -1389,7 +1389,7 @@ SectionRef MachOObjectFile::getRelocationSection( const MachO::any_relocation_info &RE) const { if (isRelocationScattered(RE) || getPlainRelocationExternal(RE)) - return *end_sections(); + return *section_end(); unsigned SecNum = getPlainRelocationSymbolNum(RE) - 1; DataRefImpl DRI; DRI.d.a = SecNum; diff --git a/lib/Object/Object.cpp b/lib/Object/Object.cpp index 399d460f8ce..243bd44a02c 100644 --- a/lib/Object/Object.cpp +++ b/lib/Object/Object.cpp @@ -70,7 +70,7 @@ void LLVMDisposeObjectFile(LLVMObjectFileRef ObjectFile) { // ObjectFile Section iterators LLVMSectionIteratorRef LLVMGetSections(LLVMObjectFileRef ObjectFile) { - section_iterator SI = unwrap(ObjectFile)->begin_sections(); + section_iterator SI = unwrap(ObjectFile)->section_begin(); return wrap(new section_iterator(SI)); } @@ -80,7 +80,7 @@ void LLVMDisposeSectionIterator(LLVMSectionIteratorRef SI) { LLVMBool LLVMIsSectionIteratorAtEnd(LLVMObjectFileRef ObjectFile, LLVMSectionIteratorRef SI) { - return (*unwrap(SI) == unwrap(ObjectFile)->end_sections()) ? 1 : 0; + return (*unwrap(SI) == unwrap(ObjectFile)->section_end()) ? 1 : 0; } void LLVMMoveToNextSection(LLVMSectionIteratorRef SI) { @@ -95,7 +95,7 @@ void LLVMMoveToContainingSection(LLVMSectionIteratorRef Sect, // ObjectFile Symbol iterators LLVMSymbolIteratorRef LLVMGetSymbols(LLVMObjectFileRef ObjectFile) { - symbol_iterator SI = unwrap(ObjectFile)->begin_symbols(); + symbol_iterator SI = unwrap(ObjectFile)->symbol_begin(); return wrap(new symbol_iterator(SI)); } @@ -105,7 +105,7 @@ void LLVMDisposeSymbolIterator(LLVMSymbolIteratorRef SI) { LLVMBool LLVMIsSymbolIteratorAtEnd(LLVMObjectFileRef ObjectFile, LLVMSymbolIteratorRef SI) { - return (*unwrap(SI) == unwrap(ObjectFile)->end_symbols()) ? 1 : 0; + return (*unwrap(SI) == unwrap(ObjectFile)->symbol_end()) ? 1 : 0; } void LLVMMoveToNextSymbol(LLVMSymbolIteratorRef SI) { @@ -151,7 +151,7 @@ LLVMBool LLVMGetSectionContainsSymbol(LLVMSectionIteratorRef SI, // Section Relocation iterators LLVMRelocationIteratorRef LLVMGetRelocations(LLVMSectionIteratorRef Section) { - relocation_iterator SI = (*unwrap(Section))->begin_relocations(); + relocation_iterator SI = (*unwrap(Section))->relocation_begin(); return wrap(new relocation_iterator(SI)); } @@ -161,7 +161,7 @@ void LLVMDisposeRelocationIterator(LLVMRelocationIteratorRef SI) { LLVMBool LLVMIsRelocationIteratorAtEnd(LLVMSectionIteratorRef Section, LLVMRelocationIteratorRef SI) { - return (*unwrap(SI) == (*unwrap(Section))->end_relocations()) ? 1 : 0; + return (*unwrap(SI) == (*unwrap(Section))->relocation_end()) ? 1 : 0; } void LLVMMoveToNextRelocation(LLVMRelocationIteratorRef SI) { diff --git a/tools/llvm-ar/llvm-ar.cpp b/tools/llvm-ar/llvm-ar.cpp index 1a1fd8a4833..bc9ad37e5d3 100644 --- a/tools/llvm-ar/llvm-ar.cpp +++ b/tools/llvm-ar/llvm-ar.cpp @@ -716,8 +716,8 @@ static void writeSymbolTable( print32BE(Out, 0); } - for (object::symbol_iterator I = Obj->begin_symbols(), - E = Obj->end_symbols(); + for (object::symbol_iterator I = Obj->symbol_begin(), + E = Obj->symbol_end(); I != E; ++I) { uint32_t Symflags = I->getFlags();; if (Symflags & object::SymbolRef::SF_FormatSpecific) diff --git a/tools/llvm-nm/llvm-nm.cpp b/tools/llvm-nm/llvm-nm.cpp index 3a72862776f..fd18454a8f0 100644 --- a/tools/llvm-nm/llvm-nm.cpp +++ b/tools/llvm-nm/llvm-nm.cpp @@ -365,7 +365,7 @@ static char getSymbolNMTypeChar(COFFObjectFile &Obj, symbol_iterator I) { uint32_t Characteristics = 0; if (Symb->SectionNumber > 0) { - section_iterator SecI = Obj.end_sections(); + section_iterator SecI = Obj.section_end(); if (error(I->getSection(SecI))) return '?'; const coff_section *Section = Obj.getCOFFSection(SecI); @@ -415,7 +415,7 @@ static char getSymbolNMTypeChar(MachOObjectFile &Obj, symbol_iterator I) { case MachO::N_ABS: return 's'; case MachO::N_SECT: { - section_iterator Sec = Obj.end_sections(); + section_iterator Sec = Obj.section_end(); Obj.getSymbolSection(Symb, Sec); DataRefImpl Ref = Sec->getRawDataRefImpl(); StringRef SectionName; @@ -493,29 +493,29 @@ static char getNMTypeChar(ObjectFile *Obj, symbol_iterator I) { static void getDynamicSymbolIterators(ObjectFile *Obj, symbol_iterator &Begin, symbol_iterator &End) { if (ELF32LEObjectFile *ELF = dyn_cast(Obj)) { - Begin = ELF->begin_dynamic_symbols(); - End = ELF->end_dynamic_symbols(); + Begin = ELF->dynamic_symbol_begin(); + End = ELF->dynamic_symbol_end(); return; } if (ELF64LEObjectFile *ELF = dyn_cast(Obj)) { - Begin = ELF->begin_dynamic_symbols(); - End = ELF->end_dynamic_symbols(); + Begin = ELF->dynamic_symbol_begin(); + End = ELF->dynamic_symbol_end(); return; } if (ELF32BEObjectFile *ELF = dyn_cast(Obj)) { - Begin = ELF->begin_dynamic_symbols(); - End = ELF->end_dynamic_symbols(); + Begin = ELF->dynamic_symbol_begin(); + End = ELF->dynamic_symbol_end(); return; } ELF64BEObjectFile *ELF = cast(Obj); - Begin = ELF->begin_dynamic_symbols(); - End = ELF->end_dynamic_symbols(); + Begin = ELF->dynamic_symbol_begin(); + End = ELF->dynamic_symbol_end(); return; } static void dumpSymbolNamesFromObject(ObjectFile *Obj) { - symbol_iterator IBegin = Obj->begin_symbols(); - symbol_iterator IEnd = Obj->end_symbols(); + symbol_iterator IBegin = Obj->symbol_begin(); + symbol_iterator IEnd = Obj->symbol_end(); if (DynamicSyms) { if (!Obj->isELF()) { error("File format has no dynamic symbol table", Obj->getFileName()); diff --git a/tools/llvm-objdump/COFFDump.cpp b/tools/llvm-objdump/COFFDump.cpp index dd2db2b037e..f6f0f15197b 100644 --- a/tools/llvm-objdump/COFFDump.cpp +++ b/tools/llvm-objdump/COFFDump.cpp @@ -163,7 +163,7 @@ static error_code resolveSectionAndAddress(const COFFObjectFile *Obj, uint64_t &ResolvedAddr) { if (error_code EC = Sym.getAddress(ResolvedAddr)) return EC; - section_iterator iter(Obj->begin_sections()); + section_iterator iter(Obj->section_begin()); if (error_code EC = Sym.getSection(iter)) return EC; ResolvedSection = Obj->getCOFFSection(iter); @@ -320,7 +320,7 @@ void llvm::printCOFFUnwindInfo(const COFFObjectFile *Obj) { const coff_section *Pdata = 0; - for (section_iterator SI = Obj->begin_sections(), SE = Obj->end_sections(); + for (section_iterator SI = Obj->section_begin(), SE = Obj->section_end(); SI != SE; ++SI) { StringRef Name; if (error(SI->getName(Name))) continue; @@ -329,8 +329,8 @@ void llvm::printCOFFUnwindInfo(const COFFObjectFile *Obj) { Pdata = Obj->getCOFFSection(SI); std::vector Rels; - for (relocation_iterator RI = SI->begin_relocations(), - RE = SI->end_relocations(); + for (relocation_iterator RI = SI->relocation_begin(), + RE = SI->relocation_end(); RI != RE; ++RI) Rels.push_back(*RI); diff --git a/tools/llvm-objdump/MachODump.cpp b/tools/llvm-objdump/MachODump.cpp index b8ce9c884a7..35e424d60b4 100644 --- a/tools/llvm-objdump/MachODump.cpp +++ b/tools/llvm-objdump/MachODump.cpp @@ -154,13 +154,13 @@ getSectionsAndSymbols(const MachO::mach_header Header, std::vector &Symbols, SmallVectorImpl &FoundFns, uint64_t &BaseSegmentAddress) { - for (symbol_iterator SI = MachOObj->begin_symbols(), - SE = MachOObj->end_symbols(); + for (symbol_iterator SI = MachOObj->symbol_begin(), + SE = MachOObj->symbol_end(); SI != SE; ++SI) Symbols.push_back(*SI); - for (section_iterator SI = MachOObj->begin_sections(), - SE = MachOObj->end_sections(); + for (section_iterator SI = MachOObj->section_begin(), + SE = MachOObj->section_end(); SI != SE; ++SI) { SectionRef SR = *SI; StringRef SectName; @@ -329,8 +329,8 @@ static void DisassembleInputMachO2(StringRef Filename, // Parse relocations. std::vector > Relocs; - for (relocation_iterator RI = Sections[SectIdx].begin_relocations(), - RE = Sections[SectIdx].end_relocations(); + for (relocation_iterator RI = Sections[SectIdx].relocation_begin(), + RE = Sections[SectIdx].relocation_end(); RI != RE; ++RI) { uint64_t RelocOffset, SectionAddress; RI->getOffset(RelocOffset); diff --git a/tools/llvm-objdump/llvm-objdump.cpp b/tools/llvm-objdump/llvm-objdump.cpp index 4572c965481..3b87507af0a 100644 --- a/tools/llvm-objdump/llvm-objdump.cpp +++ b/tools/llvm-objdump/llvm-objdump.cpp @@ -386,14 +386,14 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) { // in RelocSecs contain the relocations for section S. error_code EC; std::map > SectionRelocMap; - for (section_iterator I = Obj->begin_sections(), E = Obj->end_sections(); + for (section_iterator I = Obj->section_begin(), E = Obj->section_end(); I != E; ++I) { section_iterator Sec2 = I->getRelocatedSection(); - if (Sec2 != Obj->end_sections()) + if (Sec2 != Obj->section_end()) SectionRelocMap[*Sec2].push_back(*I); } - for (section_iterator I = Obj->begin_sections(), E = Obj->end_sections(); + for (section_iterator I = Obj->section_begin(), E = Obj->section_end(); I != E; ++I) { bool Text; if (error(I->isText(Text))) @@ -407,7 +407,7 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) { // Make a list of all the symbols in this section. std::vector > Symbols; - for (symbol_iterator SI = Obj->begin_symbols(), SE = Obj->end_symbols(); + for (symbol_iterator SI = Obj->symbol_begin(), SE = Obj->symbol_end(); SI != SE; ++SI) { bool contains; if (!error(I->containsSymbol(*SI, contains)) && contains) { @@ -435,8 +435,8 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) { for (SmallVectorImpl::iterator RelocSec = RelocSecs->begin(), E = RelocSecs->end(); RelocSec != E; ++RelocSec) { - for (relocation_iterator RI = RelocSec->begin_relocations(), - RE = RelocSec->end_relocations(); + for (relocation_iterator RI = RelocSec->relocation_begin(), + RE = RelocSec->relocation_end(); RI != RE; ++RI) Rels.push_back(*RI); } @@ -552,15 +552,15 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) { } static void PrintRelocations(const ObjectFile *o) { - for (section_iterator si = o->begin_sections(), se = o->end_sections(); + for (section_iterator si = o->section_begin(), se = o->section_end(); si != se; ++si) { - if (si->begin_relocations() == si->end_relocations()) + if (si->relocation_begin() == si->relocation_end()) continue; StringRef secname; if (error(si->getName(secname))) continue; outs() << "RELOCATION RECORDS FOR [" << secname << "]:\n"; - for (relocation_iterator ri = si->begin_relocations(), - re = si->end_relocations(); + for (relocation_iterator ri = si->relocation_begin(), + re = si->relocation_end(); ri != re; ++ri) { bool hidden; uint64_t address; @@ -581,7 +581,7 @@ static void PrintSectionHeaders(const ObjectFile *o) { outs() << "Sections:\n" "Idx Name Size Address Type\n"; unsigned i = 0; - for (section_iterator si = o->begin_sections(), se = o->end_sections(); + for (section_iterator si = o->section_begin(), se = o->section_end(); si != se; ++si) { StringRef Name; if (error(si->getName(Name))) @@ -604,7 +604,7 @@ static void PrintSectionHeaders(const ObjectFile *o) { static void PrintSectionContents(const ObjectFile *o) { error_code EC; - for (section_iterator si = o->begin_sections(), se = o->end_sections(); + for (section_iterator si = o->section_begin(), se = o->section_end(); si != se; ++si) { StringRef Name; StringRef Contents; @@ -696,14 +696,14 @@ static void PrintSymbolTable(const ObjectFile *o) { if (const COFFObjectFile *coff = dyn_cast(o)) PrintCOFFSymbolTable(coff); else { - for (symbol_iterator si = o->begin_symbols(), se = o->end_symbols(); + for (symbol_iterator si = o->symbol_begin(), se = o->symbol_end(); si != se; ++si) { StringRef Name; uint64_t Address; SymbolRef::Type Type; uint64_t Size; uint32_t Flags = si->getFlags(); - section_iterator Section = o->end_sections(); + section_iterator Section = o->section_end(); if (error(si->getName(Name))) continue; if (error(si->getAddress(Address))) continue; if (error(si->getType(Type))) continue; @@ -743,7 +743,7 @@ static void PrintSymbolTable(const ObjectFile *o) { << ' '; if (Absolute) outs() << "*ABS*"; - else if (Section == o->end_sections()) + else if (Section == o->section_end()) outs() << "*UND*"; else { if (const MachOObjectFile *MachO = diff --git a/tools/llvm-readobj/COFFDumper.cpp b/tools/llvm-readobj/COFFDumper.cpp index 08153ebd047..120794280d2 100644 --- a/tools/llvm-readobj/COFFDumper.cpp +++ b/tools/llvm-readobj/COFFDumper.cpp @@ -185,7 +185,7 @@ static error_code resolveSectionAndAddress(const COFFObjectFile *Obj, if (error_code EC = Sym.getAddress(ResolvedAddr)) return EC; - section_iterator iter(Obj->begin_sections()); + section_iterator iter(Obj->section_begin()); if (error_code EC = Sym.getSection(iter)) return EC; @@ -541,13 +541,13 @@ error_code COFFDumper::getSection( } void COFFDumper::cacheRelocations() { - for (section_iterator SecI = Obj->begin_sections(), - SecE = Obj->end_sections(); + for (section_iterator SecI = Obj->section_begin(), + SecE = Obj->section_end(); SecI != SecE; ++SecI) { const coff_section *Section = Obj->getCOFFSection(SecI); - for (relocation_iterator RelI = SecI->begin_relocations(), - RelE = SecI->end_relocations(); + for (relocation_iterator RelI = SecI->relocation_begin(), + RelE = SecI->relocation_end(); RelI != RelE; ++RelI) RelocMap[Section].push_back(*RelI); @@ -818,8 +818,8 @@ void COFFDumper::printCodeViewLineTables(section_iterator SecI) { void COFFDumper::printSections() { ListScope SectionsD(W, "Sections"); int SectionNumber = 0; - for (section_iterator SecI = Obj->begin_sections(), - SecE = Obj->end_sections(); + for (section_iterator SecI = Obj->section_begin(), + SecE = Obj->section_end(); SecI != SecE; ++SecI) { ++SectionNumber; const coff_section *Section = Obj->getCOFFSection(SecI); @@ -845,16 +845,16 @@ void COFFDumper::printSections() { if (opts::SectionRelocations) { ListScope D(W, "Relocations"); - for (relocation_iterator RelI = SecI->begin_relocations(), - RelE = SecI->end_relocations(); + for (relocation_iterator RelI = SecI->relocation_begin(), + RelE = SecI->relocation_end(); RelI != RelE; ++RelI) printRelocation(SecI, RelI); } if (opts::SectionSymbols) { ListScope D(W, "Symbols"); - for (symbol_iterator SymI = Obj->begin_symbols(), - SymE = Obj->end_symbols(); + for (symbol_iterator SymI = Obj->symbol_begin(), + SymE = Obj->symbol_end(); SymI != SymE; ++SymI) { bool Contained = false; if (SecI->containsSymbol(*SymI, Contained) || !Contained) @@ -880,8 +880,8 @@ void COFFDumper::printRelocations() { ListScope D(W, "Relocations"); int SectionNumber = 0; - for (section_iterator SecI = Obj->begin_sections(), - SecE = Obj->end_sections(); + for (section_iterator SecI = Obj->section_begin(), + SecE = Obj->section_end(); SecI != SecE; ++SecI) { ++SectionNumber; StringRef Name; @@ -889,8 +889,8 @@ void COFFDumper::printRelocations() { continue; bool PrintedGroup = false; - for (relocation_iterator RelI = SecI->begin_relocations(), - RelE = SecI->end_relocations(); + for (relocation_iterator RelI = SecI->relocation_begin(), + RelE = SecI->relocation_end(); RelI != RelE; ++RelI) { if (!PrintedGroup) { W.startLine() << "Section (" << SectionNumber << ") " << Name << " {\n"; @@ -939,7 +939,7 @@ void COFFDumper::printRelocation(section_iterator SecI, void COFFDumper::printSymbols() { ListScope Group(W, "Symbols"); - for (symbol_iterator SymI = Obj->begin_symbols(), SymE = Obj->end_symbols(); + for (symbol_iterator SymI = Obj->symbol_begin(), SymE = Obj->symbol_end(); SymI != SymE; ++SymI) printSymbol(SymI); } @@ -1087,8 +1087,8 @@ void COFFDumper::printUnwindInfo() { } void COFFDumper::printX64UnwindInfo() { - for (section_iterator SecI = Obj->begin_sections(), - SecE = Obj->end_sections(); + for (section_iterator SecI = Obj->section_begin(), + SecE = Obj->section_end(); SecI != SecE; ++SecI) { StringRef Name; if (error(SecI->getName(Name))) diff --git a/tools/llvm-readobj/MachODumper.cpp b/tools/llvm-readobj/MachODumper.cpp index af76901a3f1..ef699b30bf7 100644 --- a/tools/llvm-readobj/MachODumper.cpp +++ b/tools/llvm-readobj/MachODumper.cpp @@ -222,8 +222,8 @@ void MachODumper::printSections(const MachOObjectFile *Obj) { ListScope Group(W, "Sections"); int SectionIndex = -1; - for (section_iterator SecI = Obj->begin_sections(), - SecE = Obj->end_sections(); + for (section_iterator SecI = Obj->section_begin(), + SecE = Obj->section_end(); SecI != SecE; ++SecI) { ++SectionIndex; @@ -258,16 +258,16 @@ void MachODumper::printSections(const MachOObjectFile *Obj) { if (opts::SectionRelocations) { ListScope D(W, "Relocations"); - for (relocation_iterator RelI = SecI->begin_relocations(), - RelE = SecI->end_relocations(); + for (relocation_iterator RelI = SecI->relocation_begin(), + RelE = SecI->relocation_end(); RelI != RelE; ++RelI) printRelocation(SecI, RelI); } if (opts::SectionSymbols) { ListScope D(W, "Symbols"); - for (symbol_iterator SymI = Obj->begin_symbols(), - SymE = Obj->end_symbols(); + for (symbol_iterator SymI = Obj->symbol_begin(), + SymE = Obj->symbol_end(); SymI != SymE; ++SymI) { bool Contained = false; if (SecI->containsSymbol(*SymI, Contained) || !Contained) @@ -290,16 +290,16 @@ void MachODumper::printRelocations() { ListScope D(W, "Relocations"); error_code EC; - for (section_iterator SecI = Obj->begin_sections(), - SecE = Obj->end_sections(); + for (section_iterator SecI = Obj->section_begin(), + SecE = Obj->section_end(); SecI != SecE; ++SecI) { StringRef Name; if (error(SecI->getName(Name))) continue; bool PrintedGroup = false; - for (relocation_iterator RelI = SecI->begin_relocations(), - RelE = SecI->end_relocations(); + for (relocation_iterator RelI = SecI->relocation_begin(), + RelE = SecI->relocation_end(); RelI != RelE; ++RelI) { if (!PrintedGroup) { W.startLine() << "Section " << Name << " {\n"; @@ -331,7 +331,7 @@ void MachODumper::printRelocation(const MachOObjectFile *Obj, if (error(RelI->getOffset(Offset))) return; if (error(RelI->getTypeName(RelocName))) return; symbol_iterator Symbol = RelI->getSymbol(); - if (Symbol != Obj->end_symbols() && + if (Symbol != Obj->symbol_end() && error(Symbol->getName(SymbolName))) return; @@ -370,7 +370,7 @@ void MachODumper::printRelocation(const MachOObjectFile *Obj, void MachODumper::printSymbols() { ListScope Group(W, "Symbols"); - for (symbol_iterator SymI = Obj->begin_symbols(), SymE = Obj->end_symbols(); + for (symbol_iterator SymI = Obj->symbol_begin(), SymE = Obj->symbol_end(); SymI != SymE; ++SymI) { printSymbol(SymI); } @@ -389,9 +389,9 @@ void MachODumper::printSymbol(symbol_iterator SymI) { getSymbol(Obj, SymI->getRawDataRefImpl(), Symbol); StringRef SectionName = ""; - section_iterator SecI(Obj->end_sections()); + section_iterator SecI(Obj->section_begin()); if (!error(SymI->getSection(SecI)) && - SecI != Obj->end_sections()) + SecI != Obj->section_end()) error(SecI->getName(SectionName)); DictScope D(W, "Symbol"); diff --git a/tools/llvm-size/llvm-size.cpp b/tools/llvm-size/llvm-size.cpp index f46bf6b4a20..c2d24462758 100644 --- a/tools/llvm-size/llvm-size.cpp +++ b/tools/llvm-size/llvm-size.cpp @@ -111,7 +111,7 @@ static void PrintObjectSectionSizes(ObjectFile *o) { std::size_t max_name_len = strlen("section"); std::size_t max_size_len = strlen("size"); std::size_t max_addr_len = strlen("addr"); - for (section_iterator i = o->begin_sections(), e = o->end_sections(); + for (section_iterator i = o->section_begin(), e = o->section_end(); i != e; ++i) { uint64_t size = 0; if (error(i->getSize(size))) @@ -150,7 +150,7 @@ static void PrintObjectSectionSizes(ObjectFile *o) { << "%#" << max_addr_len << radix_fmt << "\n"; // Print each section. - for (section_iterator i = o->begin_sections(), e = o->end_sections(); + for (section_iterator i = o->section_begin(), e = o->section_end(); i != e; ++i) { StringRef name; uint64_t size = 0; @@ -181,7 +181,7 @@ static void PrintObjectSectionSizes(ObjectFile *o) { uint64_t total_bss = 0; // Make one pass over the section table to calculate sizes. - for (section_iterator i = o->begin_sections(), e = o->end_sections(); + for (section_iterator i = o->section_begin(), e = o->section_end(); i != e; ++i) { uint64_t size = 0; bool isText = false; diff --git a/tools/llvm-symbolizer/LLVMSymbolize.cpp b/tools/llvm-symbolizer/LLVMSymbolize.cpp index 40751998579..9f329a6de61 100644 --- a/tools/llvm-symbolizer/LLVMSymbolize.cpp +++ b/tools/llvm-symbolizer/LLVMSymbolize.cpp @@ -52,7 +52,7 @@ static void patchFunctionNameInDILineInfo(const std::string &NewFunctionName, ModuleInfo::ModuleInfo(ObjectFile *Obj, DIContext *DICtx) : Module(Obj), DebugInfoContext(DICtx) { - for (symbol_iterator si = Module->begin_symbols(), se = Module->end_symbols(); + for (symbol_iterator si = Module->symbol_begin(), se = Module->symbol_end(); si != se; ++si) { SymbolRef::Type SymbolType; if (error(si->getType(SymbolType))) @@ -265,7 +265,7 @@ static bool getGNUDebuglinkContents(const Binary *Bin, std::string &DebugName, const ObjectFile *Obj = dyn_cast(Bin); if (!Obj) return false; - for (section_iterator I = Obj->begin_sections(), E = Obj->end_sections(); + for (section_iterator I = Obj->section_begin(), E = Obj->section_end(); I != E; ++I) { StringRef Name; I->getName(Name); diff --git a/tools/macho-dump/macho-dump.cpp b/tools/macho-dump/macho-dump.cpp index f2f4b8c70f0..dbb2700b77e 100644 --- a/tools/macho-dump/macho-dump.cpp +++ b/tools/macho-dump/macho-dump.cpp @@ -202,7 +202,7 @@ static int DumpSymtabCommand(const MachOObjectFile &Obj) { // Dump the symbol table. outs() << " ('_symbols', [\n"; unsigned SymNum = 0; - for (symbol_iterator I = Obj.begin_symbols(), E = Obj.end_symbols(); I != E; + for (symbol_iterator I = Obj.symbol_begin(), E = Obj.symbol_end(); I != E; ++I, ++SymNum) { DataRefImpl DRI = I->getRawDataRefImpl(); if (Obj.is64Bit()) { diff --git a/tools/obj2yaml/coff2yaml.cpp b/tools/obj2yaml/coff2yaml.cpp index 47ccfb77000..8fdd4aee0c9 100644 --- a/tools/obj2yaml/coff2yaml.cpp +++ b/tools/obj2yaml/coff2yaml.cpp @@ -51,8 +51,8 @@ void COFFDumper::dumpHeader(const object::coff_file_header *Header) { void COFFDumper::dumpSections(unsigned NumSections) { std::vector &Sections = YAMLObj.Sections; - for (object::section_iterator iter = Obj.begin_sections(); - iter != Obj.end_sections(); ++iter) { + for (object::section_iterator iter = Obj.section_begin(); + iter != Obj.section_end(); ++iter) { const object::coff_section *Sect = Obj.getCOFFSection(iter); COFFYAML::Section Sec; Sec.Name = Sect->Name; // FIXME: check the null termination! @@ -65,8 +65,8 @@ void COFFDumper::dumpSections(unsigned NumSections) { Sec.SectionData = object::yaml::BinaryRef(sectionData); std::vector Relocations; - for (object::relocation_iterator rIter = iter->begin_relocations(); - rIter != iter->end_relocations(); ++rIter) { + for (object::relocation_iterator rIter = iter->relocation_begin(); + rIter != iter->relocation_end(); ++rIter) { const object::coff_relocation *reloc = Obj.getCOFFRelocation(rIter); COFFYAML::Relocation Rel; object::symbol_iterator Sym = rIter->getSymbol(); @@ -82,8 +82,8 @@ void COFFDumper::dumpSections(unsigned NumSections) { void COFFDumper::dumpSymbols(unsigned NumSymbols) { std::vector &Symbols = YAMLObj.Symbols; - for (object::symbol_iterator iter = Obj.begin_symbols(); - iter != Obj.end_symbols(); ++iter) { + for (object::symbol_iterator iter = Obj.symbol_begin(); + iter != Obj.symbol_end(); ++iter) { const object::coff_symbol *Symbol = Obj.getCOFFSymbol(iter); COFFYAML::Symbol Sym; Obj.getSymbolName(Symbol, Sym.Name);