This is an archive of the discontinued LLVM Phabricator instance.

[llvm-objcopy] Remove unused field from Object
ClosedPublic

Authored by alexander-shaposhnikov on Jun 6 2018, 4:47 PM.

Details

Summary

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

Diff Detail

Repository
rL LLVM

Event Timeline

Object.h
622 ↗(On Diff #150219)

Object is never deleted polymorphically, it's not even a part of a hierarchy, probably the class itself should be marked final.

jhenderson added inline comments.Jun 7 2018, 1:42 AM
Object.h
587 ↗(On Diff #150219)

Don't you actually want to remove this field though?

Object.h
587 ↗(On Diff #150219)

right, right, wrong diff

attach the correct diff

jhenderson accepted this revision.Jun 7 2018, 2:24 AM

Okay, that makes more sense!

LGTM.

This revision is now accepted and ready to land.Jun 7 2018, 2:24 AM
This revision was automatically updated to reflect the committed changes.