[llvm-commits] [llvm] r58042 - /llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
Daniel Dunbar
daniel at zuster.org
Thu Oct 23 12:37:35 PDT 2008
Author: ddunbar
Date: Thu Oct 23 14:37:34 2008
New Revision: 58042
URL: http://llvm.org/viewvc/llvm-project?rev=58042&view=rev
Log:
Make sure to set stdout to binary when writing bitcode files via
std::ostream API.
Modified:
llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=58042&r1=58041&r2=58042&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Thu Oct 23 14:37:34 2008
@@ -1332,6 +1332,9 @@
/// 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);
}
More information about the llvm-commits
mailing list