[PATCH] D68164: [Commandline] Clear error on raw_ostream when there is parsing error.

Yuanfang Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 30 21:45:15 PDT 2019


ychen added a comment.

In D68164#1689152 <https://reviews.llvm.org/D68164#1689152>, @ychen wrote:

> In D68164#1689148 <https://reviews.llvm.org/D68164#1689148>, @ruiu wrote:
>
> > So, could you add a testcase to demonstrate the issue?
> >
> > If an error occurs, I believe this piece of code will try to call report_fatal_error and that will fail too for the same reason (because if the code fails, it is likely that we can't write anything to stderr), and the process will exit with exit code 1. So, is the new behavior implemented in this patch distinguishable from the existing behavior? If a command behaves differently with this patch, please add a test to demonstrate it.
>
>
> The new behavior is not distinguishable from the existing behavior from the user's perspective. The existing behavior does exit(1)-> report_fatal_error -> exit(1) and new behavior just exit(1) cleanly.


Another perspective is that the `report_fatal_error` in raw_fd_ostream is to make sure errors are not silently ignored before the destructor is called, which is exactly what this patch is for.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68164/new/

https://reviews.llvm.org/D68164





More information about the llvm-commits mailing list