diff --git a/lib/Bitcode/Writer/BitWriter.cpp b/lib/Bitcode/Writer/BitWriter.cpp index d7b15104662..727ea3ff636 100644 --- a/lib/Bitcode/Writer/BitWriter.cpp +++ b/lib/Bitcode/Writer/BitWriter.cpp @@ -17,7 +17,7 @@ using namespace llvm; /*===-- Operations on modules ---------------------------------------------===*/ int LLVMWriteBitcodeToFile(LLVMModuleRef M, const char *Path) { - std::ofstream OS(Path); + std::ofstream OS(Path, std::ios_base::out|std::ios::trunc|std::ios::binary); if (!OS.fail()) WriteBitcodeToFile(unwrap(M), OS);