From 8649fc053be167bfdf93e19c40fc9f78b3d5ebfa Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Mon, 7 Nov 2016 23:43:07 +0000 Subject: [PATCH] [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 --- llvm/lib/LTO/LTOCodeGenerator.cpp | 2 ++ 1 file changed, 2 insertions(+) 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 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; -- 2.7.4