diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-07-05 21:01:08 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-07-05 21:01:08 +0000 |
commit | 200c748a8643cd127271f4d6849da1e147d4442f (patch) | |
tree | 0eacbac147a7d5d59d0e41281c4b11f4784b0c50 /tools/bugpoint/ExecutionDriver.cpp | |
parent | cd56727b555fd009c691d1c4ae308fbaf50e0c4f (diff) | |
download | llvm-200c748a8643cd127271f4d6849da1e147d4442f.tar.gz llvm-200c748a8643cd127271f4d6849da1e147d4442f.tar.bz2 llvm-200c748a8643cd127271f4d6849da1e147d4442f.tar.xz |
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).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185726 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint/ExecutionDriver.cpp')
-rw-r--r-- | tools/bugpoint/ExecutionDriver.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/bugpoint/ExecutionDriver.cpp b/tools/bugpoint/ExecutionDriver.cpp index 270dab2317..3d3dac3274 100644 --- a/tools/bugpoint/ExecutionDriver.cpp +++ b/tools/bugpoint/ExecutionDriver.cpp @@ -267,7 +267,7 @@ void BugDriver::compileProgram(Module *M, std::string *Error) const { // Emit the program to a bitcode file... SmallString<128> BitcodeFile; int BitcodeFD; - error_code EC = sys::fs::unique_file( + error_code EC = sys::fs::createUniqueFile( OutputPrefix + "-test-program-%%%%%%%.bc", BitcodeFD, BitcodeFile); if (EC) { errs() << ToolName << ": Error making unique filename: " << EC.message() @@ -306,7 +306,7 @@ std::string BugDriver::executeProgram(const Module *Program, // Emit the program to a bitcode file... SmallString<128> UniqueFilename; int UniqueFD; - error_code EC = sys::fs::unique_file( + error_code EC = sys::fs::createUniqueFile( OutputPrefix + "-test-program-%%%%%%%.bc", UniqueFD, UniqueFilename); if (EC) { errs() << ToolName << ": Error making unique filename: " @@ -332,7 +332,7 @@ std::string BugDriver::executeProgram(const Module *Program, // Check to see if this is a valid output filename... SmallString<128> UniqueFile; - error_code EC = sys::fs::unique_file(OutputFile, UniqueFile); + error_code EC = sys::fs::createUniqueFile(OutputFile, UniqueFile); if (EC) { errs() << ToolName << ": Error making unique filename: " << EC.message() << "\n"; |