[llvm] r330172 - COFF: Make SectionChunk::Relocs field an ArrayRef. NFCI.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 16 18:54:34 PDT 2018


Author: pcc
Date: Mon Apr 16 18:54:34 2018
New Revision: 330172

URL: http://llvm.org/viewvc/llvm-project?rev=330172&view=rev
Log:
COFF: Make SectionChunk::Relocs field an ArrayRef. NFCI.

Differential Revision: https://reviews.llvm.org/D45714

Modified:
    llvm/trunk/include/llvm/Object/COFF.h
    llvm/trunk/lib/Object/COFFObjectFile.cpp

Modified: llvm/trunk/include/llvm/Object/COFF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/COFF.h?rev=330172&r1=330171&r2=330172&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/COFF.h (original)
+++ llvm/trunk/include/llvm/Object/COFF.h Mon Apr 16 18:54:34 2018
@@ -1012,8 +1012,7 @@ public:
     llvm_unreachable("null symbol table pointer!");
   }
 
-  iterator_range<const coff_relocation *>
-  getRelocations(const coff_section *Sec) const;
+  ArrayRef<coff_relocation> getRelocations(const coff_section *Sec) const;
 
   std::error_code getSectionName(const coff_section *Sec, StringRef &Res) const;
   uint64_t getSectionSize(const coff_section *Sec) const;

Modified: llvm/trunk/lib/Object/COFFObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/COFFObjectFile.cpp?rev=330172&r1=330171&r2=330172&view=diff
==============================================================================
--- llvm/trunk/lib/Object/COFFObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/COFFObjectFile.cpp Mon Apr 16 18:54:34 2018
@@ -1147,13 +1147,10 @@ COFFObjectFile::getCOFFRelocation(const
   return toRel(Reloc.getRawDataRefImpl());
 }
 
-iterator_range<const coff_relocation *>
+ArrayRef<coff_relocation>
 COFFObjectFile::getRelocations(const coff_section *Sec) const {
-  const coff_relocation *I = getFirstReloc(Sec, Data, base());
-  const coff_relocation *E = I;
-  if (I)
-    E += getNumberOfRelocations(Sec, Data, base());
-  return make_range(I, E);
+  return {getFirstReloc(Sec, Data, base()),
+          getNumberOfRelocations(Sec, Data, base())};
 }
 
 #define LLVM_COFF_SWITCH_RELOC_TYPE_NAME(reloc_type)                           \




More information about the llvm-commits mailing list