diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-06-18 17:01:00 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-06-18 17:01:00 +0000 |
commit | 8ee23f00c7e9343d09313051c318906558d6ad17 (patch) | |
tree | 3e8f0a4c0340268de38b841319840ed5b12d54dd /tools/bugpoint | |
parent | 21a78d149fc3939b19fe8a132ece0b4c1bd62517 (diff) | |
download | llvm-8ee23f00c7e9343d09313051c318906558d6ad17.tar.gz llvm-8ee23f00c7e9343d09313051c318906558d6ad17.tar.bz2 llvm-8ee23f00c7e9343d09313051c318906558d6ad17.tar.xz |
Add a version of unique_file that return just the file name.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184206 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint')
-rw-r--r-- | tools/bugpoint/ExecutionDriver.cpp | 10 | ||||
-rw-r--r-- | tools/bugpoint/OptimizerDriver.cpp | 12 |
2 files changed, 3 insertions, 19 deletions
diff --git a/tools/bugpoint/ExecutionDriver.cpp b/tools/bugpoint/ExecutionDriver.cpp index 5390808128..6edf2335f6 100644 --- a/tools/bugpoint/ExecutionDriver.cpp +++ b/tools/bugpoint/ExecutionDriver.cpp @@ -21,12 +21,6 @@ #include "llvm/Support/raw_ostream.h" #include <fstream> -#if !defined(_MSC_VER) && !defined(__MINGW32__) -#include <unistd.h> -#else -#include <io.h> -#endif - using namespace llvm; namespace { @@ -338,15 +332,13 @@ std::string BugDriver::executeProgram(const Module *Program, // Check to see if this is a valid output filename... SmallString<128> UniqueFile; - int UniqueFD; - error_code EC = sys::fs::unique_file(OutputFile, UniqueFD, UniqueFile); + error_code EC = sys::fs::unique_file(OutputFile, UniqueFile); if (EC) { errs() << ToolName << ": Error making unique filename: " << EC.message() << "\n"; exit(1); } OutputFile = UniqueFile.str(); - close(UniqueFD); // Figure out which shared objects to run, if any. std::vector<std::string> SharedObjs(AdditionalSOs); diff --git a/tools/bugpoint/OptimizerDriver.cpp b/tools/bugpoint/OptimizerDriver.cpp index 3af551f43d..43f2d3318a 100644 --- a/tools/bugpoint/OptimizerDriver.cpp +++ b/tools/bugpoint/OptimizerDriver.cpp @@ -34,12 +34,6 @@ #include <fstream> -#if !defined(_MSC_VER) && !defined(__MINGW32__) -#include <unistd.h> -#else -#include <io.h> -#endif - using namespace llvm; namespace llvm { @@ -130,16 +124,14 @@ bool BugDriver::runPasses(Module *Program, // setup the output file name outs().flush(); SmallString<128> UniqueFilename; - int UniqueFD; - error_code EC = sys::fs::unique_file(OutputPrefix + "-output-%%%%%%%.bc", - UniqueFD, UniqueFilename); + error_code EC = + sys::fs::unique_file(OutputPrefix + "-output-%%%%%%%.bc", UniqueFilename); if (EC) { errs() << getToolName() << ": Error making unique filename: " << EC.message() << "\n"; return 1; } OutputFilename = UniqueFilename.str(); - close(UniqueFD); // We only want the filename. // set up the input file name SmallString<128> InputFilename; |