From bf92b3f48014fdcd51605657604c87a1924729cb Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Tue, 12 Mar 2019 02:17:01 +0000 Subject: [PATCH] llvm-objcopy: Remove unused field. NFCI. Differential Revision: https://reviews.llvm.org/D59126 llvm-svn: 355892 --- llvm/tools/llvm-objcopy/ELF/Object.cpp | 4 +--- llvm/tools/llvm-objcopy/ELF/Object.h | 8 ++------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/llvm/tools/llvm-objcopy/ELF/Object.cpp b/llvm/tools/llvm-objcopy/ELF/Object.cpp index d859c7e..afa48e5 100644 --- a/llvm/tools/llvm-objcopy/ELF/Object.cpp +++ b/llvm/tools/llvm-objcopy/ELF/Object.cpp @@ -901,9 +901,7 @@ template void ELFBuilder::setParentSegment(Segment &Child) { template void ELFBuilder::readProgramHeaders() { uint32_t Index = 0; for (const auto &Phdr : unwrapOrError(ElfFile.program_headers())) { - ArrayRef 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; diff --git a/llvm/tools/llvm-objcopy/ELF/Object.h b/llvm/tools/llvm-objcopy/ELF/Object.h index dabec85..4675c22 100644 --- a/llvm/tools/llvm-objcopy/ELF/Object.h +++ b/llvm/tools/llvm-objcopy/ELF/Object.h @@ -312,10 +312,6 @@ public: uint32_t Index; uint64_t OriginalOffset; Segment *ParentSegment = nullptr; - ArrayRef Contents; - - explicit Segment(ArrayRef Data) : Contents(Data) {} - Segment() {} const SectionBase *firstSection() const { if (!Sections.empty()) @@ -827,8 +823,8 @@ public: Ptr->Index = Sections.size(); return *Ptr; } - Segment &addSegment(ArrayRef Data) { - Segments.emplace_back(llvm::make_unique(Data)); + Segment &addSegment() { + Segments.emplace_back(llvm::make_unique()); return *Segments.back(); } }; -- 2.7.4