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.

llvm-svn: 104882
This commit is contained in:
Dan Gohman 2010-05-27 20:19:47 +00:00
parent 7559394270
commit ab366f055a
1 changed files with 3 additions and 1 deletions

View File

@ -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;
}