[PATCH] Modify OwningBinary interface to separate inspection from ownership transfer.

Lang Hames lhames at gmail.com
Thu Oct 30 16:00:22 PDT 2014


Hi Guys,

The following patch modifies the OwningBuffer class to separate inspection
and ownership transfer.

The getBinary and getBuffer method now return ordinary pointers (with
appropriate const-ness). To transfer ownership, you now call takeBinary(),
which returns a pair of the Binary and a MemoryBuffer. This interface is
odd, but an improvement over transferring the two things separately - this
way it is impossible to forget to transfer one of the pair.

In a future patch I'll look at moving clients of these methods to just
holding OwningBinary - that's probably what they want anyway.

Does this look reasonable?

Cheers,
Lang.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141030/97e6c1ee/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OwningBinaryOwnershipCleanup.patch
Type: application/octet-stream
Size: 5925 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141030/97e6c1ee/attachment.obj>


More information about the llvm-commits mailing list