Make sure to set stdout to binary when writing bitcode files via

std::ostream API.

llvm-svn: 58042
This commit is contained in:
Daniel Dunbar 2008-10-23 19:37:34 +00:00
parent 62951678ee
commit f4be24686f
1 changed files with 3 additions and 0 deletions

View File

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