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

Duncan P. N. Exon Smith dexonsmith at apple.com
Tue Sep 2 14:38:27 PDT 2014

> 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.

It's probably worth documenting the failure behaviour in the doxygen.
Otherwise (assuming David agrees) this LGTM.

More information about the llvm-commits mailing list