summaryrefslogtreecommitdiffstats
path: root/llvm/tools/bugpoint/OptimizerDriver.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-07-05 21:01:08 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-07-05 21:01:08 +0000
commitc9d2e5b8ca06bdb9af8338ec7dde5eafad40d9f0 (patch)
treea5d007b8b2b1a7b425b799c0ec49a1f3c60e2456 /llvm/tools/bugpoint/OptimizerDriver.cpp
parent10357900342fe7509f28f95edf3e01119227d311 (diff)
downloadbcm5719-llvm-c9d2e5b8ca06bdb9af8338ec7dde5eafad40d9f0.tar.gz
bcm5719-llvm-c9d2e5b8ca06bdb9af8338ec7dde5eafad40d9f0.zip
Add a createUniqueFile function and switch llvm's users of unique_file.
This function is complementary to createTemporaryFile. It handles the case were the unique file is *not* temporary: we will rename it in the end. Since we will rename it, the file has to be in the same filesystem as the final destination and we don't prepend the system temporary directory. This has a small semantic difference from unique_file: the default mode is 0666. This matches the behavior of most unix tools. For example, with this change lld now produces files with the same permissions as ld. I will add a test of this change when I port clang over to createUniqueFile (next commit). llvm-svn: 185726
Diffstat (limited to 'llvm/tools/bugpoint/OptimizerDriver.cpp')
-rw-r--r--llvm/tools/bugpoint/OptimizerDriver.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/tools/bugpoint/OptimizerDriver.cpp b/llvm/tools/bugpoint/OptimizerDriver.cpp
index 43f2d3318ae..36d536ab89c 100644
--- a/llvm/tools/bugpoint/OptimizerDriver.cpp
+++ b/llvm/tools/bugpoint/OptimizerDriver.cpp
@@ -124,8 +124,8 @@ bool BugDriver::runPasses(Module *Program,
// setup the output file name
outs().flush();
SmallString<128> UniqueFilename;
- error_code EC =
- sys::fs::unique_file(OutputPrefix + "-output-%%%%%%%.bc", UniqueFilename);
+ error_code EC = sys::fs::createUniqueFile(
+ OutputPrefix + "-output-%%%%%%%.bc", UniqueFilename);
if (EC) {
errs() << getToolName() << ": Error making unique filename: "
<< EC.message() << "\n";
@@ -136,8 +136,8 @@ bool BugDriver::runPasses(Module *Program,
// set up the input file name
SmallString<128> InputFilename;
int InputFD;
- EC = sys::fs::unique_file(OutputPrefix + "-input-%%%%%%%.bc", InputFD,
- InputFilename);
+ EC = sys::fs::createUniqueFile(OutputPrefix + "-input-%%%%%%%.bc", InputFD,
+ InputFilename);
if (EC) {
errs() << getToolName() << ": Error making unique filename: "
<< EC.message() << "\n";
OpenPOWER on IntegriCloud