OSDN Git Service

COFF: Make SectionChunk::Relocs field an ArrayRef. NFCI.
authorPeter Collingbourne <peter@pcc.me.uk>
Tue, 17 Apr 2018 01:54:34 +0000 (01:54 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Tue, 17 Apr 2018 01:54:34 +0000 (01:54 +0000)
Differential Revision: https://reviews.llvm.org/D45714

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330172 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Object/COFF.h
lib/Object/COFFObjectFile.cpp

index 9190149..99048ab 100644 (file)
@@ -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;
index e45246b..ab4cc60 100644 (file)
@@ -1147,13 +1147,10 @@ COFFObjectFile::getCOFFRelocation(const RelocationRef &Reloc) 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)                           \