Yuri
2010-Jun-16 16:13 UTC
[LLVMdev] Should file opening error during raw_fd_stream::raw_fd_stream exit instead of passing the error up to the caller?
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. Yuri
Reid Kleckner
2010-Jun-16 18:22 UTC
[LLVMdev] Should file opening error during raw_fd_stream::raw_fd_stream exit instead of passing the error up to the caller?
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 somewhere else. 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. Reid
Maybe Matching Threads
- [LLVMdev] Why -jit-emit-debug doesn't work with gdb-7.1 ?
- [LLVMdev] Why -jit-emit-debug doesn't work with gdb-7.1 ?
- [LLVMdev] Why -jit-emit-debug doesn't work with gdb-7.1 ?
- [LLVMdev] Behaviour of outs()?
- [LLVMdev] Anyone notice the duplication of ELF Relocation enums in two different places?