Remove another unused, and IMHO, not very desirable feature of ErrorOr.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 5 Nov 2013 23:41:57 +0000 (23:41 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 5 Nov 2013 23:41:57 +0000 (23:41 +0000)
commitc86cf046501035b9b931bb2a86ed7b81b8fa9847
tree47e4813bc586cc04687041729e92f4a3bfd8eff6
parentc9080b7bc9fa7acb8cfe65e22b40697ef8286c27
Remove another unused, and IMHO, not very desirable feature of ErrorOr.

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
include/llvm/Support/ErrorOr.h