diff options
author | Dan Gohman <gohman@apple.com> | 2010-05-27 20:19:47 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-05-27 20:19:47 +0000 |
commit | 16cd44914b2734339850495d6834f4b501cc267b (patch) | |
tree | c294213d1d6213633ef3be8b5ecc7ca65fe616d8 /tools | |
parent | 52a56041c165e1e59897fe30a2b0c216d5b02288 (diff) | |
download | external_llvm-16cd44914b2734339850495d6834f4b501cc267b.zip external_llvm-16cd44914b2734339850495d6834f4b501cc267b.tar.gz external_llvm-16cd44914b2734339850495d6834f4b501cc267b.tar.bz2 |
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
Diffstat (limited to 'tools')
-rw-r--r-- | tools/lto/LTOCodeGenerator.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/lto/LTOCodeGenerator.cpp b/tools/lto/LTOCodeGenerator.cpp index 59e8405..c4d7e8a 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; } |