diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-07-05 20:14:52 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-07-05 20:14:52 +0000 |
commit | 1276b396130a0cdbbb8e6c05a6e43123df18ed60 (patch) | |
tree | 73ac5fcf6f4ef004a672e098cf8318d113338772 /tools | |
parent | e11874f6c5e33f5c2d634bfd33e1ae67c93f9b74 (diff) | |
download | llvm-1276b396130a0cdbbb8e6c05a6e43123df18ed60.tar.gz llvm-1276b396130a0cdbbb8e6c05a6e43123df18ed60.tar.bz2 llvm-1276b396130a0cdbbb8e6c05a6e43123df18ed60.tar.xz |
Use sys::fs::createTemporaryFile.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185719 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/bugpoint/Miscompilation.cpp | 16 | ||||
-rw-r--r-- | tools/bugpoint/ToolRunner.cpp | 4 | ||||
-rw-r--r-- | tools/lto/LTOCodeGenerator.cpp | 3 |
3 files changed, 11 insertions, 12 deletions
diff --git a/tools/bugpoint/Miscompilation.cpp b/tools/bugpoint/Miscompilation.cpp index 73b5cd1fe8..5574303321 100644 --- a/tools/bugpoint/Miscompilation.cpp +++ b/tools/bugpoint/Miscompilation.cpp @@ -928,8 +928,8 @@ static bool TestCodeGenerator(BugDriver &BD, Module *Test, Module *Safe, SmallString<128> TestModuleBC; int TestModuleFD; - error_code EC = sys::fs::unique_file("bugpoint.test-%%%%%%%.bc", TestModuleFD, - TestModuleBC); + error_code EC = sys::fs::createTemporaryFile("bugpoint.test", "bc", + TestModuleFD, TestModuleBC); if (EC) { errs() << BD.getToolName() << "Error making unique filename: " << EC.message() << "\n"; @@ -947,8 +947,8 @@ static bool TestCodeGenerator(BugDriver &BD, Module *Test, Module *Safe, // Make the shared library SmallString<128> SafeModuleBC; int SafeModuleFD; - EC = sys::fs::unique_file("bugpoint.safe-%%%%%%%.bc", SafeModuleFD, - SafeModuleBC); + EC = sys::fs::createTemporaryFile("bugpoint.safe", "bc", SafeModuleFD, + SafeModuleBC); if (EC) { errs() << BD.getToolName() << "Error making unique filename: " << EC.message() << "\n"; @@ -1022,8 +1022,8 @@ bool BugDriver::debugCodeGenerator(std::string *Error) { SmallString<128> TestModuleBC; int TestModuleFD; - error_code EC = sys::fs::unique_file("bugpoint.test-%%%%%%%.bc", TestModuleFD, - TestModuleBC); + error_code EC = sys::fs::createTemporaryFile("bugpoint.test", "bc", + TestModuleFD, TestModuleBC); if (EC) { errs() << getToolName() << "Error making unique filename: " << EC.message() << "\n"; @@ -1040,8 +1040,8 @@ bool BugDriver::debugCodeGenerator(std::string *Error) { // Make the shared library SmallString<128> SafeModuleBC; int SafeModuleFD; - EC = sys::fs::unique_file("bugpoint.safe-%%%%%%%.bc", SafeModuleFD, - SafeModuleBC); + EC = sys::fs::createTemporaryFile("bugpoint.safe", "bc", SafeModuleFD, + SafeModuleBC); if (EC) { errs() << getToolName() << "Error making unique filename: " << EC.message() << "\n"; diff --git a/tools/bugpoint/ToolRunner.cpp b/tools/bugpoint/ToolRunner.cpp index a9a4a9d27f..bec00364d7 100644 --- a/tools/bugpoint/ToolRunner.cpp +++ b/tools/bugpoint/ToolRunner.cpp @@ -141,8 +141,8 @@ static std::string ProcessFailure(StringRef ProgPath, const char** Args, // Rerun the compiler, capturing any error messages to print them. SmallString<128> ErrorFilename; int ErrorFD; - error_code EC = sys::fs::unique_file("bugpoint.program_error_messages", - ErrorFD, ErrorFilename); + error_code EC = sys::fs::createTemporaryFile( + "bugpoint.program_error_messages", "", ErrorFD, ErrorFilename); if (EC) { errs() << "Error making unique filename: " << EC.message() << "\n"; exit(1); diff --git a/tools/lto/LTOCodeGenerator.cpp b/tools/lto/LTOCodeGenerator.cpp index 88f2a0f27e..022a04c178 100644 --- a/tools/lto/LTOCodeGenerator.cpp +++ b/tools/lto/LTOCodeGenerator.cpp @@ -162,8 +162,7 @@ bool LTOCodeGenerator::compile_to_file(const char** name, std::string& errMsg) { // make unique temp .o file to put generated object file SmallString<128> Filename; int FD; - error_code EC = sys::fs::unique_file("lto-llvm-%%%%%%%.o", - FD, Filename); + error_code EC = sys::fs::createTemporaryFile("lto-llvm", "o", FD, Filename); if (EC) { errMsg = EC.message(); return true; |