[PATCH] Add ErrorOr<>::getOrDie() which uses report_fatal_error instead of assert.

Alexander Kornienko alexfh at google.com
Thu Oct 9 12:01:48 PDT 2014


I would use it whenever I need to handle runtime error which I can't
recover from and I don't have a better way to report the error. I don't
agree that it's invisible, the name is pretty explicit in what it does. The
specific use case is handling parsing errors in clang-tidy check-specific
options. Parsing happens in the check constructor which doesn't have a
better way of reporting an error. See http://reviews.llvm.org/D5602 for the
patch where I would use this method instead of ErrorOr<>::operator*.
On 9 Oct 2014 22:29, "Reid Kleckner" <rnk at google.com> wrote:

> I don't think we should be burying invisible calls to report_fatal_error
> in libraries. Can you point at the code which wants to do this?
>
> On Thu, Oct 9, 2014 at 10:30 AM, Alexander Kornienko <alexfh at google.com>
> wrote:
>
>> Hi rafael,
>>
>> This method allows writing code that consistently fails in case of
>> dereferencing an ErrorOr<> containing no value rather than crashing in
>> debug and
>> using uninitialized data in release build.
>>
>> http://reviews.llvm.org/D5706
>>
>> Files:
>>   include/llvm/Support/ErrorOr.h
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141009/e36a7579/attachment.html>


More information about the llvm-commits mailing list