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

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Sep 3 10:42:46 PDT 2014


Cool. I changed it in r217049.

On 2 September 2014 17:50, David Blaikie <dblaikie at gmail.com> wrote:
>
>
>
> 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.




More information about the llvm-commits mailing list