[llvm] r220231 - Add const version of OwningBinary::getBinary

David Blaikie dblaikie at gmail.com
Mon Oct 20 13:48:59 PDT 2014


On Mon, Oct 20, 2014 at 1:32 PM, Alexey Samsonov <vonosmas at gmail.com> wrote:

> Author: samsonov
> Date: Mon Oct 20 15:32:47 2014
> New Revision: 220231
>
> URL: http://llvm.org/viewvc/llvm-project?rev=220231&view=rev
> Log:
> Add const version of OwningBinary::getBinary
>
> Modified:
>     llvm/trunk/include/llvm/Object/Binary.h
>
> Modified: llvm/trunk/include/llvm/Object/Binary.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/Binary.h?rev=220231&r1=220230&r2=220231&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/Object/Binary.h (original)
> +++ llvm/trunk/include/llvm/Object/Binary.h Mon Oct 20 15:32:47 2014
> @@ -140,6 +140,7 @@ public:
>    OwningBinary<T> &operator=(OwningBinary<T> &&Other);
>
>    std::unique_ptr<T> &getBinary();
> +  const std::unique_ptr<T> &getBinary() const;
>    std::unique_ptr<MemoryBuffer> &getBuffer();
>  };
>
> @@ -165,6 +166,11 @@ template <typename T> std::unique_ptr<T>
>    return Bin;
>  }
>
> +template <typename T>
> +const std::unique_ptr<T> &OwningBinary<T>::getBinary() const {
>

Slightly curious thing to have a const version of, though it's probably the
best thing for symmetry (since ownership can't be transferred, it could
just return T* or, if it's always non-null, a T& - but it'd be weirdly
asymmetric). What's it for?


> +  return Bin;
> +}
> +
>  template <typename T>
>  std::unique_ptr<MemoryBuffer> &OwningBinary<T>::getBuffer() {
>    return Buf;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141020/5658e2a4/attachment.html>


More information about the llvm-commits mailing list