[PATCH] D33960: ErrorHandling: report_fatal_error: call abort() instead of exit()

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 7 17:13:32 PDT 2017


MatzeB added a comment.

In https://reviews.llvm.org/D33960#864222, @chandlerc wrote:

> > I think the question is, is a report_fatal_error exit indicative of a bug, or is it possibly working as intended? For a long time we've treated it as a valid (but lazy and crappy) way to handle errors in library code. Are we changing that? I could be OK with that as long as its announced. If we want to do this, we should announce it as a new direction for the project on llvm-dev.
>
> I feel like almost every time I have hit `report_fatal_error`, I have wanted it to break in a debugger and potentially provide a stack trace. Maybe I'm weird though.


Exactly the same for me and that was my motivation for this patch.

> But I don't see how library code calling `exit(1)` is *ever* going to be a useful error handling mechanism. So I think any place we do this in libraries is either trying to do something like `abort()` (and reasonable) or trying to propagate an error and needs to be fixed pretty badly. Maybe by making it print stack traces and such we will actually be better at going and fixing these issues.
> 
> All that said I'm pretty happy asking for somewhat widespread communication of the fact that this is changing. It *is* a change, and we shouldn't paper over that. I just think it is probably the right direction.

I agree.


Repository:
  rL LLVM

https://reviews.llvm.org/D33960





More information about the llvm-commits mailing list