diff options
| -rw-r--r-- | lld/lib/ReaderWriter/ELF/ELFFile.h | 35 | ||||
| -rw-r--r-- | lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h | 8 | 
2 files changed, 19 insertions, 24 deletions
diff --git a/lld/lib/ReaderWriter/ELF/ELFFile.h b/lld/lib/ReaderWriter/ELF/ELFFile.h index ed6cfa31b12..4e630094b29 100644 --- a/lld/lib/ReaderWriter/ELF/ELFFile.h +++ b/lld/lib/ReaderWriter/ELF/ELFFile.h @@ -465,47 +465,44 @@ template <class ELFT> error_code ELFFile<ELFT>::createAtomizableSections() {    // the contents to the RelocationReferences map.    // Record the number of relocs to guess at preallocating the buffer.    uint64_t totalRelocs = 0; -  for (auto sit = _objFile->begin_sections(), sie = _objFile->end_sections(); -       sit != sie; ++sit) { -    const Elf_Shdr *section = &*sit; - -    if (isIgnoredSection(section)) +  for (const Elf_Shdr §ion : _objFile->sections()) { +    if (isIgnoredSection(§ion))        continue; -    if (isMergeableStringSection(section)) { -      _mergeStringSections.push_back(section); +    if (isMergeableStringSection(§ion)) { +      _mergeStringSections.push_back(§ion);        continue;      }      // Create a sectionSymbols entry for every progbits section. -    if ((section->sh_type == llvm::ELF::SHT_PROGBITS) || -        (section->sh_type == llvm::ELF::SHT_INIT_ARRAY) || -        (section->sh_type == llvm::ELF::SHT_FINI_ARRAY)) -      _sectionSymbols[section]; +    if ((section.sh_type == llvm::ELF::SHT_PROGBITS) || +        (section.sh_type == llvm::ELF::SHT_INIT_ARRAY) || +        (section.sh_type == llvm::ELF::SHT_FINI_ARRAY)) +      _sectionSymbols[§ion]; -    if (section->sh_type == llvm::ELF::SHT_RELA) { -      auto sHdr = _objFile->getSection(section->sh_info); +    if (section.sh_type == llvm::ELF::SHT_RELA) { +      auto sHdr = _objFile->getSection(section.sh_info);        auto sectionName = _objFile->getSectionName(sHdr);        if (error_code ec = sectionName.getError())          return ec; -      auto rai(_objFile->begin_rela(section)); -      auto rae(_objFile->end_rela(section)); +      auto rai(_objFile->begin_rela(§ion)); +      auto rae(_objFile->end_rela(§ion));        _relocationAddendReferences[*sectionName] = make_range(rai, rae);        totalRelocs += std::distance(rai, rae);      } -    if (section->sh_type == llvm::ELF::SHT_REL) { -      auto sHdr = _objFile->getSection(section->sh_info); +    if (section.sh_type == llvm::ELF::SHT_REL) { +      auto sHdr = _objFile->getSection(section.sh_info);        auto sectionName = _objFile->getSectionName(sHdr);        if (error_code ec = sectionName.getError())          return ec; -      auto ri(_objFile->begin_rel(section)); -      auto re(_objFile->end_rel(section)); +      auto ri(_objFile->begin_rel(§ion)); +      auto re(_objFile->end_rel(§ion));        _relocationReferences[*sectionName] = make_range(ri, re);        totalRelocs += std::distance(ri, re); diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h b/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h index 735a4c0f112..6819f44f2ad 100644 --- a/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h +++ b/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h @@ -136,13 +136,11 @@ private:    error_code readRegInfo() {      typedef llvm::object::Elf_RegInfo<ELFT> Elf_RegInfo; -    for (auto sit = this->_objFile->begin_sections(), -              sie = this->_objFile->end_sections(); -         sit != sie; ++sit) { -      if (sit->sh_type != llvm::ELF::SHT_MIPS_REGINFO) +    for (const Elf_Shdr §ion : this->_objFile->sections()) { +      if (section.sh_type != llvm::ELF::SHT_MIPS_REGINFO)          continue; -      auto contents = this->getSectionContents(&*sit); +      auto contents = this->getSectionContents(§ion);        if (error_code ec = contents.getError())          return ec;  | 

