Skip to content

Commit

Permalink
[LTO] Add error message on IO error in compileOptimizedToFile.
Browse files Browse the repository at this point in the history
(No testcase because it's difficult to force an error here.)

Differential Revision: https://reviews.llvm.org/D26371

llvm-svn: 286177
  • Loading branch information
Eli Friedman committed Nov 7, 2016
1 parent 65d86e4 commit 8649fc0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions llvm/lib/LTO/LTOCodeGenerator.cpp
Expand Up @@ -257,6 +257,8 @@ bool LTOCodeGenerator::compileOptimizedToFile(const char **Name) {
bool genResult = compileOptimized(&objFile.os());
objFile.os().close();
if (objFile.os().has_error()) {
Twine ErrMsg = "could not write object file: " + Filename.str();
emitError(ErrMsg.str());
objFile.os().clear_error();
sys::fs::remove(Twine(Filename));
return false;
Expand Down

0 comments on commit 8649fc0

Please sign in to comment.