[patch] Pass a MemoryBufferRef when we can avoid taking ownership

David Blaikie dblaikie at gmail.com
Tue Sep 2 14:50:14 PDT 2014


On Tue, Sep 2, 2014 at 2:38 PM, Duncan P. N. Exon Smith <
dexonsmith at apple.com> wrote:

>
> > On 2014 Aug 26, at 18:26, Rafael EspĂ­ndola <rafael.espindola at gmail.com>
> wrote:
> >
> >> Actually I did mean && - it's not uncommon for APIs to take by movement
> then
> >> fail to move-from in their failure path. Granted in the C++ standard
> library
> >> that failure is demonstrated by throwing an exception, whereas this has
> a
> >> return result.
> >
> > OK, so this patch (on top of all previous which were already
> > committed) changes the & to &&. I personally find a
> > "foo(std::move(bar))" that doesn't always move bar to be a bit
> > confusing, but if that is common, I am OK with it.
>
> I agree that this is a bit unexpected, but I think David's right that
> it's better than the alternative.
>

*nod* 'preciate the second opinion. I could be convinced either way, but at
least wanted to float the idea.


> It's probably worth documenting the failure behaviour in the doxygen.
>

Yep - whether it's by T& or T&&, it should be documented.


> Otherwise (assuming David agrees) this LGTM.


Yep yep.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140902/cb130c91/attachment.html>


More information about the llvm-commits mailing list