[LLVMdev] Should file opening error during raw_fd_stream::raw_fd_stream exit instead of passing the error up to the caller?
reid.kleckner at gmail.com
Wed Jun 16 11:22:17 PDT 2010
On Wed, Jun 16, 2010 at 9:13 AM, Yuri <yuri at rawbw.com> wrote:
> In several places, for example in JITDebugRegisterer::MakeELF, stream is
> opened and the error is ignored. When the error is actually returned by open
> There are two solutions (assuming there are no exceptions).
> 1. check error string after every raw_fd_stream::raw_fd_stream, fix all
> the places where the check is missing
> 2. make raw_fd_stream::raw_fd_stream exit
> I suggest the second should be done since there are really no situations
> when the file error should be tolerated.
I think raw_fd_ostream is a general purpose enough interface that it
should report recovery. I can imagine a situation where you might
want to try to open a filepath, but it fails because a parent
directory doesn't exist, and you fall back to opening the file
Perhaps the error string should be made optional, and if it is not
supplied, raw_fd_ostream can print the error and exit itself. This
should make the task of updating the callers simpler, since the error
handling code needs to be written only once.
More information about the llvm-dev