[patch] Simplify ErrorOr

Rafael EspĂ­ndola rafael.espindola at gmail.com
Sat Nov 2 15:06:23 PDT 2013


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvm.patch
Type: text/x-patch
Size: 9248 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131102/0ccf01b4/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lld.patch
Type: text/x-patch
Size: 13712 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131102/0ccf01b4/attachment-0001.bin>


More information about the llvm-commits mailing list