From 4b7416b75db2a4b80ccffe6e15c0d7b6996a8201 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 27 May 2010 20:19:47 +0000 Subject: When handling raw_ostream errors manually, use clear_error() so that raw_ostream doesn't try to do its own error handling. Also, close the raw_ostream before checking for errors so that any errors that occur during closing are caught by the manual check. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104882 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/lto/LTOCodeGenerator.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tools/lto') diff --git a/tools/lto/LTOCodeGenerator.cpp b/tools/lto/LTOCodeGenerator.cpp index 59e8405e7e..c4d7e8abe7 100644 --- a/tools/lto/LTOCodeGenerator.cpp +++ b/tools/lto/LTOCodeGenerator.cpp @@ -152,10 +152,12 @@ bool LTOCodeGenerator::writeMergedModules(const char *path, // write bitcode to it WriteBitcodeToFile(_linker.getModule(), Out); - + Out.close(); + if (Out.has_error()) { errMsg = "could not write bitcode file: "; errMsg += path; + Out.clear_error(); return true; } -- cgit v1.2.3