OSDN Git Service

[llvm-objcopy] Remove unused field from Object
authorAlexander Shaposhnikov <shal1t712@gmail.com>
Thu, 7 Jun 2018 19:41:42 +0000 (19:41 +0000)
committerAlexander Shaposhnikov <shal1t712@gmail.com>
Thu, 7 Jun 2018 19:41:42 +0000 (19:41 +0000)
The class Object contains std::shared_ptr<MemoryBuffer> OwnedData
which is not used anywhere. Besides avoiding two stage initialization
the motivation to remove it comes from the plan to add (currently missing) support
for static libraries.
NFC.

Test plan: make check-all

Differential revision: https://reviews.llvm.org/D47855

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

tools/llvm-objcopy/Object.cpp
tools/llvm-objcopy/Object.h

index 606e032..6842067 100644 (file)
@@ -835,7 +835,7 @@ ElfType ELFReader::getElfType() const {
 }
 
 std::unique_ptr<Object> ELFReader::create() const {
-  auto Obj = llvm::make_unique<Object>(Data);
+  auto Obj = llvm::make_unique<Object>();
   if (auto *o = dyn_cast<ELFObjectFile<ELF32LE>>(Bin.get())) {
     ELFBuilder<ELF32LE> Builder(*o, *Obj);
     Builder.build();
index c7939b4..48de0e5 100644 (file)
@@ -584,7 +584,6 @@ private:
   using SecPtr = std::unique_ptr<SectionBase>;
   using SegPtr = std::unique_ptr<Segment>;
 
-  std::shared_ptr<MemoryBuffer> OwnedData;
   std::vector<SecPtr> Sections;
   std::vector<SegPtr> Segments;
 
@@ -617,10 +616,6 @@ public:
   StringTableSection *SectionNames = nullptr;
   SymbolTableSection *SymbolTable = nullptr;
 
-  explicit Object(std::shared_ptr<MemoryBuffer> Data)
-      : OwnedData(std::move(Data)) {}
-  virtual ~Object() = default;
-
   void sortSections();
   SectionTableRef sections() { return SectionTableRef(Sections); }
   ConstRange<SectionBase> sections() const {