r215856 - Update for llvm api changes.
Kim Gräsman
kim.grasman at gmail.com
Mon Aug 18 23:15:46 PDT 2014
On Mon, Aug 18, 2014 at 1:25 AM, David Blaikie <dblaikie at gmail.com> wrote:
> On Sun, Aug 17, 2014 at 3:20 PM, Rafael Espindola
> <rafael.espindola at gmail.com> wrote:
>>
>> llvm::SourceMgr SM;
>> - Stream YAMLStream(FileBufOrErr.get().release(), SM);
>> + Stream YAMLStream(std::move(FileBufOrErr.get()), SM);
>
> Thought: this is actually one place where I more strongly prefer using
> the pointer-like API of ErrorOr. Seeing "move(x.get())" makes me
> twitch and think "is that moving a raw pointer? some mistake where the
> user was trying to indicate transfer of ownership from a unique_ptr
> and clearly failing". Whereas move(*x) seems clear/sort of better.
I also did a double-take when I updated our tool and saw this. I
considered std::move(*x), and I agree that it's less confusing, but I
wonder if something more explicit could be done with ErrorOr to move
out its value? A take() method, for example (I can't quite see clearly
how it would play with move semantics for non-movable T's, exercise
for the reader.)
- Kim
More information about the cfe-commits
mailing list