This is necessary on windows targets, since stdout is in text mode there.
Patch by Julien Lerouge!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52038
91177308-0d34-0410-b5e6-
96231b3b80d8
#include "llvm/TypeSymbolTable.h"
#include "llvm/ValueSymbolTable.h"
#include "llvm/Support/MathExtras.h"
+#include "llvm/System/Program.h"
using namespace llvm;
/// These are manifest constants used by the bitcode writer. They do not need to
// Emit the module.
WriteModule(M, Stream);
+ // If writing to stdout, set binary mode.
+ if (llvm::cout == Out)
+ sys::Program::ChangeStdoutToBinary();
+
// Write the generated bitstream to "Out".
Out.write((char*)&Buffer.front(), Buffer.size());