[llvm-commits] [llvm] r52038 - /llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
Anton Korobeynikov
asl at math.spbu.ru
Fri Jun 6 00:24:01 PDT 2008
Author: asl
Date: Fri Jun 6 02:24:01 2008
New Revision: 52038
URL: http://llvm.org/viewvc/llvm-project?rev=52038&view=rev
Log:
Turn stdout into binary mode during bitcode emission.
This is necessary on windows targets, since stdout is in text mode there.
Patch by Julien Lerouge!
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=52038&r1=52037&r2=52038&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Fri Jun 6 02:24:01 2008
@@ -23,6 +23,7 @@
#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
@@ -1292,6 +1293,10 @@
// 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());
More information about the llvm-commits
mailing list