Don't use PathV1.h in tools/bugpoint/Miscompilation.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184193 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2013-06-18 15:29:32 +00:00
parent 9c22f87b13
commit 88088f4067
3 changed files with 49 additions and 30 deletions

View File

@@ -49,20 +49,28 @@ namespace {
/// writeProgramToFile - This writes the current "Program" to the named bitcode
/// file. If an error occurs, true is returned.
///
static bool writeProgramToFileAux(tool_output_file &Out, const Module *M) {
WriteBitcodeToFile(M, Out.os());
Out.os().close();
if (!Out.os().has_error()) {
Out.keep();
return false;
}
return true;
}
bool BugDriver::writeProgramToFile(const std::string &Filename, int FD,
const Module *M) const {
tool_output_file Out(Filename.c_str(), FD);
return writeProgramToFileAux(Out, M);
}
bool BugDriver::writeProgramToFile(const std::string &Filename,
const Module *M) const {
std::string ErrInfo;
tool_output_file Out(Filename.c_str(), ErrInfo,
raw_fd_ostream::F_Binary);
if (ErrInfo.empty()) {
WriteBitcodeToFile(M, Out.os());
Out.os().close();
if (!Out.os().has_error()) {
Out.keep();
return false;
}
}
Out.os().clear_error();
tool_output_file Out(Filename.c_str(), ErrInfo, raw_fd_ostream::F_Binary);
if (ErrInfo.empty())
return writeProgramToFileAux(Out, M);
return true;
}