aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Bitcode
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2008-10-23 19:37:34 +0000
committerDaniel Dunbar <daniel@zuster.org>2008-10-23 19:37:34 +0000
commite2e9d8e6aa914b81d79ff496736165f3358c6f3a (patch)
tree8dcc678ebd3ce5ae91d654782fd0071e9cc1dd25 /lib/Bitcode
parentee4c619b3b28a42078fc8033e5dccd42fc6edd42 (diff)
downloadexternal_llvm-e2e9d8e6aa914b81d79ff496736165f3358c6f3a.zip
external_llvm-e2e9d8e6aa914b81d79ff496736165f3358c6f3a.tar.gz
external_llvm-e2e9d8e6aa914b81d79ff496736165f3358c6f3a.tar.bz2
Make sure to set stdout to binary when writing bitcode files via
std::ostream API. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58042 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode')
-rw-r--r--lib/Bitcode/Writer/BitcodeWriter.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp
index 913c2bc..279e447 100644
--- a/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -1332,6 +1332,9 @@ static void EmitDarwinBCTrailer(BitstreamWriter &Stream, unsigned BufferSize) {
/// stream.
void llvm::WriteBitcodeToFile(const Module *M, std::ostream &Out) {
raw_os_ostream RawOut(Out);
+ // If writing to stdout, set binary mode.
+ if (llvm::cout == Out)
+ sys::Program::ChangeStdoutToBinary();
WriteBitcodeToFile(M, RawOut);
}