From f9f44f3d5ad391e5b17916b4198e442d1a64a0b1 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 20 Jun 2013 19:50:39 +0000 Subject: 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 --- tools/llvm-ar/llvm-ar.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'tools/llvm-ar/llvm-ar.cpp') diff --git a/tools/llvm-ar/llvm-ar.cpp b/tools/llvm-ar/llvm-ar.cpp index 53b2d02c3f..b1b175f4a7 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()); -- cgit v1.2.3