summaryrefslogtreecommitdiff
path: root/tools/bugpoint
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-23 07:49:08 +0000
committerChris Lattner <sabre@nondot.org>2009-08-23 07:49:08 +0000
commitb515d75856f58a8b3b71d782eb00916d686329ad (patch)
treef44504088f40b4ba59e2583c25ea523e8c15ae82 /tools/bugpoint
parenta81d29b3916c2eb87a17f800f3759ce21a4a96fd (diff)
downloadllvm-b515d75856f58a8b3b71d782eb00916d686329ad.tar.gz
llvm-b515d75856f58a8b3b71d782eb00916d686329ad.tar.bz2
llvm-b515d75856f58a8b3b71d782eb00916d686329ad.tar.xz
eliminate the std::ostream forms of the bitcode writing APIs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79840 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint')
-rw-r--r--tools/bugpoint/OptimizerDriver.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/tools/bugpoint/OptimizerDriver.cpp b/tools/bugpoint/OptimizerDriver.cpp
index 257647f08f..ef41c43b5f 100644
--- a/tools/bugpoint/OptimizerDriver.cpp
+++ b/tools/bugpoint/OptimizerDriver.cpp
@@ -51,10 +51,10 @@ namespace {
///
bool BugDriver::writeProgramToFile(const std::string &Filename,
Module *M) const {
- std::ios::openmode io_mode = std::ios::out | std::ios::trunc |
- std::ios::binary;
- std::ofstream Out(Filename.c_str(), io_mode);
- if (!Out.good()) return true;
+ std::string ErrInfo;
+ raw_fd_ostream Out(Filename.c_str(), ErrInfo,
+ raw_fd_ostream::F_Force|raw_fd_ostream::F_Binary);
+ if (!ErrInfo.empty()) return true;
WriteBitcodeToFile(M ? M : Program, Out);
return false;
@@ -83,11 +83,10 @@ void BugDriver::EmitProgressBitcode(const std::string &ID, bool NoFlyer) {
}
int BugDriver::runPassesAsChild(const std::vector<const PassInfo*> &Passes) {
-
- std::ios::openmode io_mode = std::ios::out | std::ios::trunc |
- std::ios::binary;
- std::ofstream OutFile(ChildOutput.c_str(), io_mode);
- if (!OutFile.good()) {
+ std::string ErrInfo;
+ raw_fd_ostream OutFile(ChildOutput.c_str(), ErrInfo,
+ raw_fd_ostream::F_Force|raw_fd_ostream::F_Binary);
+ if (!ErrInfo.empty()) {
errs() << "Error opening bitcode file: " << ChildOutput << "\n";
return 1;
}
@@ -106,7 +105,7 @@ int BugDriver::runPassesAsChild(const std::vector<const PassInfo*> &Passes) {
PM.add(createVerifierPass());
// Write bitcode out to disk as the last step...
- PM.add(CreateBitcodeWriterPass(OutFile));
+ PM.add(createBitcodeWriterPass(OutFile));
// Run all queued passes.
PM.run(*Program);
@@ -146,12 +145,15 @@ bool BugDriver::runPasses(const std::vector<const PassInfo*> &Passes,
<< ErrMsg << "\n";
return(1);
}
- std::ios::openmode io_mode = std::ios::out | std::ios::trunc |
- std::ios::binary;
- std::ofstream InFile(inputFilename.c_str(), io_mode);
- if (!InFile.good()) {
+
+ std::string ErrInfo;
+ raw_fd_ostream InFile(inputFilename.c_str(), ErrInfo,
+ raw_fd_ostream::F_Force|raw_fd_ostream::F_Binary);
+
+
+ if (!ErrInfo.empty()) {
errs() << "Error opening bitcode file: " << inputFilename << "\n";
- return(1);
+ return 1;
}
WriteBitcodeToFile(Program, InFile);
InFile.close();