From: Rafael Espindola Date: Thu, 20 Jun 2013 19:50:39 +0000 (+0000) Subject: Use a raw_fd_ostream instead of a std::ofstream. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f9f44f3d5ad391e5b17916b4198e442d1a64a0b1;p=oota-llvm.git 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 --- diff --git a/tools/llvm-ar/llvm-ar.cpp b/tools/llvm-ar/llvm-ar.cpp index 53b2d02c3fd..b1b175f4a7b 100644 --- a/tools/llvm-ar/llvm-ar.cpp +++ b/tools/llvm-ar/llvm-ar.cpp @@ -25,7 +25,6 @@ #include "llvm/Support/raw_ostream.h" #include #include -#include #include using namespace llvm; @@ -400,9 +399,11 @@ doExtract(std::string* ErrMsg) { (std::find(Paths.begin(), Paths.end(), I->getPath()) != Paths.end())) { // Open up a file stream for writing - std::ios::openmode io_mode = std::ios::out | std::ios::trunc | - std::ios::binary; - std::ofstream file(I->getPath().str().c_str(), io_mode); + std::string Err; + raw_fd_ostream file(I->getPath().str().c_str(), Err, + raw_fd_ostream::F_Binary); + if (!Err.empty()) + fail(Err); // Get the data and its length const char* data = reinterpret_cast(I->getData());