[PATCH] D45714: COFF: Make SectionChunk::Relocs field an ArrayRef. NFCI.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 16 18:57:53 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD330172: COFF: Make SectionChunk::Relocs field an ArrayRef. NFCI. (authored by pcc, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D45714?vs=142728&id=142729#toc

Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D45714

Files:
  COFF/Chunks.cpp
  COFF/Chunks.h
  COFF/ICF.cpp


Index: COFF/ICF.cpp
===================================================================
--- COFF/ICF.cpp
+++ COFF/ICF.cpp
@@ -65,7 +65,7 @@
 
 // Returns a hash value for S.
 uint32_t ICF::getHash(SectionChunk *C) {
-  return hash_combine(C->getPermissions(), C->SectionName, C->NumRelocs,
+  return hash_combine(C->getPermissions(), C->SectionName, C->Relocs.size(),
                       C->Alignment, uint32_t(C->Header->SizeOfRawData),
                       C->Checksum, C->getContents());
 }
@@ -123,7 +123,7 @@
 // Compare "non-moving" part of two sections, namely everything
 // except relocation targets.
 bool ICF::equalsConstant(const SectionChunk *A, const SectionChunk *B) {
-  if (A->NumRelocs != B->NumRelocs)
+  if (A->Relocs.size() != B->Relocs.size())
     return false;
 
   // Compare relocations.
Index: COFF/Chunks.h
===================================================================
--- COFF/Chunks.h
+++ COFF/Chunks.h
@@ -216,8 +216,7 @@
 private:
   StringRef SectionName;
   std::vector<SectionChunk *> AssocChildren;
-  llvm::iterator_range<const coff_relocation *> Relocs;
-  size_t NumRelocs;
+  ArrayRef<coff_relocation> Relocs;
 
   // Used by the garbage collector.
   bool Live;
Index: COFF/Chunks.cpp
===================================================================
--- COFF/Chunks.cpp
+++ COFF/Chunks.cpp
@@ -31,8 +31,7 @@
 
 SectionChunk::SectionChunk(ObjFile *F, const coff_section *H)
     : Chunk(SectionKind), Repl(this), Header(H), File(F),
-      Relocs(File->getCOFFObj()->getRelocations(Header)),
-      NumRelocs(std::distance(Relocs.begin(), Relocs.end())) {
+      Relocs(File->getCOFFObj()->getRelocations(Header)) {
   // Initialize SectionName.
   File->getCOFFObj()->getSectionName(Header, SectionName);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45714.142729.patch
Type: text/x-patch
Size: 1762 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180417/af152968/attachment.bin>


More information about the llvm-commits mailing list