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 | 8525fe7155a34f9e3fad0ea1012542453e803153 (patch) | |
| tree | 0e892b7149ebade5cee7d020dd1afca7fbc3a443 /llvm/tools/gold/gold-plugin.cpp | |
| parent | e3b3464d4e525c4ba1ff07329bfc7d0e2cc4f684 (diff) | |
| download | bcm5719-llvm-8525fe7155a34f9e3fad0ea1012542453e803153.tar.gz bcm5719-llvm-8525fe7155a34f9e3fad0ea1012542453e803153.zip | |
Convert tools to use tool_output_file, and introduce error
checking to places which previously lacked it.
llvm-svn: 111651
Diffstat (limited to 'llvm/tools/gold/gold-plugin.cpp')
| -rw-r--r-- | llvm/tools/gold/gold-plugin.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp index db0db3b5b2e..858af6f4324 100644 --- a/llvm/tools/gold/gold-plugin.cpp +++ b/llvm/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); |

