diff options
author | Dan Gohman <gohman@apple.com> | 2010-08-20 16:59:15 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-08-20 16:59:15 +0000 |
commit | f29140106f74d15ba357aa0a7f109adc939c3104 (patch) | |
tree | 770be753408ca9fefa28ec3a13ef8f45e00cba3a /tools/gold/gold-plugin.cpp | |
parent | e7b67d0e94df497791207618194e1db545ac3721 (diff) | |
download | llvm-f29140106f74d15ba357aa0a7f109adc939c3104.tar.gz llvm-f29140106f74d15ba357aa0a7f109adc939c3104.tar.bz2 llvm-f29140106f74d15ba357aa0a7f109adc939c3104.tar.xz |
Convert tools to use tool_output_file, and introduce error
checking to places which previously lacked it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111651 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/gold/gold-plugin.cpp')
-rw-r--r-- | tools/gold/gold-plugin.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp index db0db3b5b2..858af6f432 100644 --- a/tools/gold/gold-plugin.cpp +++ b/tools/gold/gold-plugin.cpp @@ -453,8 +453,8 @@ static ld_plugin_status all_symbols_read_hook(void) { (*message)(LDPL_ERROR, "%s", ErrMsg.c_str()); return LDPS_ERR; } - raw_fd_ostream objFile(uniqueObjPath.c_str(), ErrMsg, - raw_fd_ostream::F_Binary); + tool_output_file objFile(uniqueObjPath.c_str(), ErrMsg, + raw_fd_ostream::F_Binary); if (!ErrMsg.empty()) { (*message)(LDPL_ERROR, "%s", ErrMsg.c_str()); return LDPS_ERR; @@ -462,6 +462,13 @@ static ld_plugin_status all_symbols_read_hook(void) { objFile.write(buffer, bufsize); objFile.close(); + if (objFile.has_error()) { + (*message)(LDPL_ERROR, "Error writing output file '%s'", + uniqueObjPath.c_str()); + objFile.clear_error(); + return LDPS_ERR; + } + objFile.keep(); lto_codegen_dispose(cg); |