[LTO] Add error message on IO error in compileOptimizedToFile.
(No testcase because it's difficult to force an error here.)
Differential Revision: https://reviews.llvm.org/D26371
llvm-svn: 286177
diff --git a/llvm/lib/LTO/LTOCodeGenerator.cpp b/llvm/lib/LTO/LTOCodeGenerator.cpp
index 98ce550..ab4f968 100644
--- a/llvm/lib/LTO/LTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/LTOCodeGenerator.cpp
@@ -257,6 +257,8 @@
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;