summaryrefslogtreecommitdiff
path: root/include/llvm/Support/ErrorOr.h
Commit message (Collapse)AuthorAge
* Remove another unused, and IMHO, not very desirable feature of ErrorOr.Rafael Espindola2013-11-05
| | | | | | | | | | | | | | | | | | One of the uses of the IsValid flag is to support default constructing a ErrorOr that is not a Error or a Value. There is not much value in doing that IMHO. If ErrorOr was to have a default constructor, it should be implemented by default constructing the value, but even that looks unnecessary. The other use is to avoid calling destructors on moved objects. This looks wrong. If the data being moved has non trivial treatment of moves (an std::vector for example), it is its destructor that should handle it, not ~ErrorOr. With this change ErrorOr becomes a fairly simple wrapper and should always be better than using an error_code + value in an API. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194109 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix MSVC build by not putting an error_code directly in a union.Rafael Espindola2013-11-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194032 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify ErrorOr.Rafael Espindola2013-11-05
| | | | | | | | | | | | | | | | ErrorOr had quiet a bit of complexity and indirection to be able to hold a user type with the error. That feature is not 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 is one thing 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 the error type and ErrorOr templated over it so that we don't need the funny looking ErrorOr<void>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194030 91177308-0d34-0410-b5e6-96231b3b80d8
* Speling fixes.Benjamin Kramer2013-10-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193165 91177308-0d34-0410-b5e6-96231b3b80d8
* [Support][ErrorOr] Add support for implicit conversion from error ↵Michael J. Spencer2013-02-28
| | | | | | code/condition enums. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176228 91177308-0d34-0410-b5e6-96231b3b80d8
* [Support][ErrorOr] Add support for convertable types.Michael J. Spencer2013-02-06
| | | | | | Thanks to Andrew, David, and Aaron for helping fix this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174552 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[Support][ErrorOr] Add support for convertable types."Andrew Trick2013-02-05
| | | | | | | | | This reverts commit a33e1fafac7fedb1b080ef07ddf9ad6ddff3a830. This unit test crashes on Darwon. It needs to be temporarily reverted to unblock the test infrastructure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174458 91177308-0d34-0410-b5e6-96231b3b80d8
* Support: ensure proper state in ErrorOr copy ctors before calling 'get'Meador Inge2013-02-05
| | | | | | | | | | | Some paths through the copy constructors for 'ErrorOr' were calling 'get' when 'HasError' and 'IsValid' were not properly initialized. Depending on what happened to be in memory for those member variables the asserts in 'get' might incorrectly fire. Fixed by ensuring that the member variables in question are always initialized before calling 'get'. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174381 91177308-0d34-0410-b5e6-96231b3b80d8
* [Support][ErrorOr] Add support for convertable types.Michael J. Spencer2013-02-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174357 91177308-0d34-0410-b5e6-96231b3b80d8
* [Support][ErrorOr] Don't use nullptr :(Michael J. Spencer2013-01-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173212 91177308-0d34-0410-b5e6-96231b3b80d8
* [Support][ErrorOr] Add optimized specialization of ErrorOr<void>.Michael J. Spencer2013-01-23
| | | | | | | | ErrorOr<void> represents an operation that returns nothing, but can still fail. It should be used in cases where you need the aditional user data that ErrorOr provides over error_code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173209 91177308-0d34-0410-b5e6-96231b3b80d8
* [Support][ErrorOr] Make old gcc happy.Michael J. Spencer2013-01-22
| | | | | | Apparently this is how C++98 worked pre-DR. (Thanks Richard). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173203 91177308-0d34-0410-b5e6-96231b3b80d8
* [Support] Port ErrorOr<T> from lld to C++03.Michael J. Spencer2013-01-20
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172991 91177308-0d34-0410-b5e6-96231b3b80d8