Use a raw_fd_ostream instead of a std::ofstream.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184460 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2013-06-20 19:50:39 +00:00
parent be87bce32b
commit f9f44f3d5a

View File

@ -25,7 +25,6 @@
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
#include <algorithm> #include <algorithm>
#include <cstdlib> #include <cstdlib>
#include <fstream>
#include <memory> #include <memory>
using namespace llvm; using namespace llvm;
@ -400,9 +399,11 @@ doExtract(std::string* ErrMsg) {
(std::find(Paths.begin(), Paths.end(), I->getPath()) != Paths.end())) { (std::find(Paths.begin(), Paths.end(), I->getPath()) != Paths.end())) {
// Open up a file stream for writing // Open up a file stream for writing
std::ios::openmode io_mode = std::ios::out | std::ios::trunc | std::string Err;
std::ios::binary; raw_fd_ostream file(I->getPath().str().c_str(), Err,
std::ofstream file(I->getPath().str().c_str(), io_mode); raw_fd_ostream::F_Binary);
if (!Err.empty())
fail(Err);
// Get the data and its length // Get the data and its length
const char* data = reinterpret_cast<const char*>(I->getData()); const char* data = reinterpret_cast<const char*>(I->getData());