[Patch] ErrorOr is not a pointer, don't use a pointer API.

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Jan 8 10:46:05 PST 2014


With the mangler out of the way I got back to coding a lib/Object
interface for IR files. The first part being modernizing the IR api to
use error_code and ErrorOr.

Doing so I found one more issue with ErrorOr. It has a pointer like
API, but it is not a pointer. It stores a value of type T, not a
pointer to T. Modifying the stored object causes nothing else to be
mutated and, as was observed before, an ErrorOr<smart_pointer<T> > is
a fairly confusing thing.

The attached patch are

* add-new-api.patch: Just adds the get and getError methods.
* convert-llvm.patch: Converts llvm to use the new methods.
* convert-lld.patch: Converts lld to use the new methods.
* remove-old-api.patch: Remove the pointer API and simplify the bool operator.

Cheers,
Rafael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add-new-api.patch
Type: text/x-patch
Size: 676 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140108/f2264010/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: convert-llvm.patch
Type: text/x-patch
Size: 10238 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140108/f2264010/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: convert-lld.patch
Type: text/x-patch
Size: 46396 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140108/f2264010/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: remove-old-api.patch
Type: text/x-patch
Size: 1857 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140108/f2264010/attachment-0003.bin>


More information about the llvm-commits mailing list