[PATCH] D59126: llvm-objcopy: Remove unused field. NFCI.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 7 21:54:28 PST 2019


pcc created this revision.
pcc added reviewers: rupprecht, jhenderson.
Herald added subscribers: MaskRay, jakehehrlich, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a reviewer: alexshap.
Herald added a project: LLVM.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D59126

Files:
  llvm/tools/llvm-objcopy/ELF/Object.cpp
  llvm/tools/llvm-objcopy/ELF/Object.h


Index: llvm/tools/llvm-objcopy/ELF/Object.h
===================================================================
--- llvm/tools/llvm-objcopy/ELF/Object.h
+++ llvm/tools/llvm-objcopy/ELF/Object.h
@@ -310,10 +310,6 @@
   uint32_t Index;
   uint64_t OriginalOffset;
   Segment *ParentSegment = nullptr;
-  ArrayRef<uint8_t> Contents;
-
-  explicit Segment(ArrayRef<uint8_t> Data) : Contents(Data) {}
-  Segment() {}
 
   const SectionBase *firstSection() const {
     if (!Sections.empty())
@@ -823,8 +819,8 @@
     Ptr->Index = Sections.size();
     return *Ptr;
   }
-  Segment &addSegment(ArrayRef<uint8_t> Data) {
-    Segments.emplace_back(llvm::make_unique<Segment>(Data));
+  Segment &addSegment() {
+    Segments.emplace_back(llvm::make_unique<Segment>());
     return *Segments.back();
   }
 };
Index: llvm/tools/llvm-objcopy/ELF/Object.cpp
===================================================================
--- llvm/tools/llvm-objcopy/ELF/Object.cpp
+++ llvm/tools/llvm-objcopy/ELF/Object.cpp
@@ -886,9 +886,7 @@
 template <class ELFT> void ELFBuilder<ELFT>::readProgramHeaders() {
   uint32_t Index = 0;
   for (const auto &Phdr : unwrapOrError(ElfFile.program_headers())) {
-    ArrayRef<uint8_t> Data{ElfFile.base() + Phdr.p_offset,
-                           (size_t)Phdr.p_filesz};
-    Segment &Seg = Obj.addSegment(Data);
+    Segment &Seg = Obj.addSegment();
     Seg.Type = Phdr.p_type;
     Seg.Flags = Phdr.p_flags;
     Seg.OriginalOffset = Phdr.p_offset;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59126.189814.patch
Type: text/x-patch
Size: 1476 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190308/ebbdc84c/attachment.bin>


More information about the llvm-commits mailing list