[llvm-dev] [RFC] Error handling in LLVM libraries.

Pete Cooper via llvm-dev llvm-dev at lists.llvm.org
Tue Feb 9 17:48:48 PST 2016

Hi Rafael, Lang

> On Feb 9, 2016, at 3:27 PM, Rafael Espíndola via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> If we ever get to the point were we really want to *return* more than
> an error_code, it will be a much smaller refactoring to
> s/CheckedError/TypedError/.
So i think you’re right that we should use a CheckedError (ECError in Lang’s patch.  I don’t mind on the final name), but since a CheckedError isa TypedError, seems like we don’t have anything to lose with the generality of TypedError.

That is, if we provide TypedError as a base, then anyone can extend it as needed, and clients who only need ECError can use that.  This is more or less covered in one of Lang’s patches where he changes the return type to TypedError, but the error being returned is 'return make_typed_error<ECError>(EC);’.  If a client then decided to return something other than an ECError, you wouldn’t have to change that function return type, or any of its callers.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160209/f924eba1/attachment.html>

More information about the llvm-dev mailing list