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
diff --git a/tools/bugpoint/OptimizerDriver.cpp b/tools/bugpoint/OptimizerDriver.cpp
index 3af551f..43f2d33 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 @@
// 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;