[PATCH] D47855: [llvm-objcopy] Remove unused field from Object
Alexander Shaposhnikov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 6 16:47:44 PDT 2018
alexshap created this revision.
alexshap added reviewers: jhenderson, jakehehrlich, paulsemel.
The class Object contained std::shared_ptr<MemoryBuffer> OwnedData
which was not used anywhere. Besides avoiding two stage initialization (1st - ctor, 2nd - the actual work done by the builder) the motivation to remove it comes from the plan to add (currently missing) support for static libraries (archives) (bintuils strip supports them),
llvm::object::Archive::Child exposes MemoryBufferRef and doesn't transfer / share the ownership.
NFC.
Test plan: make check-all
Repository:
rL LLVM
https://reviews.llvm.org/D47855
Files:
Object.cpp
Object.h
Index: Object.h
===================================================================
--- Object.h
+++ Object.h
@@ -617,10 +617,6 @@
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 {
Index: Object.cpp
===================================================================
--- Object.cpp
+++ Object.cpp
@@ -835,7 +835,7 @@
}
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();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47855.150219.patch
Type: text/x-patch
Size: 906 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180606/d492aa34/attachment.bin>
More information about the llvm-commits
mailing list