[patch] Simplify ErrorOr

Alp Toker alp at nuanti.com
Sat Nov 2 16:10:16 PDT 2013


Hello Rafael,

CC'ing in Michael J. Spencer who seems to have put a lot of work into
this utility class.

Agree that the uses in LLVM core do not add value.

Following file history, the origin and main consumer of this seems to be
lld -- did you check that it still builds with your changes?

Alp.

On 02/11/2013 22:06, Rafael EspĂ­ndola wrote:
> I noticed that ErrorOr has quiet a bit of complexity and indirection
> to be able to hold a user type.
>
> That feature doesn't seem to be used anymore. This patch removes it,
> it will live in svn history if we ever need it again.
>
> If we do need it again, IMHO there are somethings that should be done
> differently
>
> * Holding extra info in the error is not a property a function also
> returning a value or not. The ability to hold extra info should be in
> error_code, so that we don't need the funny looking ErrorOr<void>.
>
> * The vast majority of use cases don't need it, so it is probably
> better to have a different type that makes it clear user data is being
> hold (say user_error_code<T>). This could then also avoid the separate
> allocation and indirection.
>
> * The need for anything more than a string is also not clear, so a
> str_error_code would probably be sufficient.
>
> Cheers,
> Rafael
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

-- 
http://www.nuanti.com
the browser experts




More information about the llvm-commits mailing list