r212408 - Update for llvm api change.

Hi Rafael,

The commit log is short on details -- could you explain why this change was needed?

The new ErrorOr<std::unique_ptr<MemoryBuffer>> pattern looks really verbose compared to what was there before, mostly doubling the lines of code you have to write to create a MemoryBuffer for a file.

And it's no longer possible to do if (std::error_code EC = ...) which makes error-checking an explicit step that's easy to forget.

I know ObjectFile is moving fast right now so guess we can wrap the functions to present a more conventional API for clang until that work settles, or maybe just try getting used to this form, but I wanted to check in with you first.

Alp.

And it's no longer possible to do if (std::error_code EC = ...) which makes
error-checking an explicit step that's easy to forget.

Quite the opposite. The main advantage of ErrorOr is that it makes
error checking mandatory. Whet EC is the return type, it is possible
to not check it and access the "actual return" type. With ErrorOr
there is an assert that prevents one from getting the value if there
is an error_code instead.

That is true for any value returning function, but without c++11
ErrorOr<move-only-type> was too cumbersome to use, which is not longer
the case.

Cheers,
Rafael