From a40b3522c82f5684a8a2c59a631b8c445288f6e1 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Mon, 10 Feb 2014 20:24:04 +0000 Subject: Change the begin and end methods in ObjectFile to match the style guide. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201108 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/DebugInfo/DWARFContext.cpp | 12 +++++----- .../RuntimeDyld/ObjectImageCommon.h | 8 +++---- lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp | 12 +++++----- lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp | 4 ++-- lib/MC/MCObjectDisassembler.cpp | 8 +++---- lib/MC/MCObjectSymbolizer.cpp | 18 +++++++------- lib/Object/COFFObjectFile.cpp | 16 ++++++------- lib/Object/MachOObjectFile.cpp | 28 +++++++++++----------- lib/Object/Object.cpp | 12 +++++----- 9 files changed, 59 insertions(+), 59 deletions(-) (limited to 'lib') diff --git a/lib/DebugInfo/DWARFContext.cpp b/lib/DebugInfo/DWARFContext.cpp index daf7cdd98c..b5b75b0408 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 2056f39b5a..f647b87f59 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 8ea941b69d..b858965b5c 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 4dbd6794c6..a4246e0c71 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 85de4111b7..5851bdfdb7 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 3fb053dd78..ee0b81ed15 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 a604acda74..a1bbc56d2b 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 3dd837c6e7..23c2d6d8bd 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 399d460f8c..243bd44a02 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) { -- cgit v1.2.3