X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=tools%2Fbugpoint%2FToolRunner.cpp;h=107d0dbaeb17fb198021851c5626687df8f812ef;hb=1b0dc64919e947bb4f4677b138c734e33061f7c4;hp=3f0779e2c54180926d5300fd7c22e02a68571bd1;hpb=3991c7274861862089530186ea4da6bda59c6964;p=oota-llvm.git diff --git a/tools/bugpoint/ToolRunner.cpp b/tools/bugpoint/ToolRunner.cpp index 3f0779e2c54..107d0dbaeb1 100644 --- a/tools/bugpoint/ToolRunner.cpp +++ b/tools/bugpoint/ToolRunner.cpp @@ -18,7 +18,6 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/FileUtilities.h" -#include "llvm/Support/PathV1.h" #include "llvm/Support/Program.h" #include "llvm/Support/raw_ostream.h" #include @@ -142,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); @@ -234,6 +233,12 @@ int LLI::ExecuteProgram(const std::string &Bitcode, void AbstractInterpreter::anchor() { } +#if defined(LLVM_ON_UNIX) +const char EXESuffix[] = ""; +#elif defined (LLVM_ON_WIN32) +const char EXESuffix[] = "exe"; +#endif + /// Prepend the path to the program being executed /// to \p ExeName, given the value of argv[0] and the address of main() /// itself. This allows us to find another LLVM tool if it is built in the same @@ -246,13 +251,13 @@ static std::string PrependMainExecutablePath(const std::string &ExeName, // Check the directory that the calling program is in. We can do // this if ProgramPath contains at least one / character, indicating that it // is a relative path to the executable itself. - sys::Path Main = sys::Path::GetMainExecutable(Argv0, MainAddr); - StringRef Result = sys::path::parent_path(Main.str()); + std::string Main = sys::fs::getMainExecutable(Argv0, MainAddr); + StringRef Result = sys::path::parent_path(Main); if (!Result.empty()) { SmallString<128> Storage = Result; sys::path::append(Storage, ExeName); - sys::path::replace_extension(Storage, sys::Path::GetEXESuffix()); + sys::path::replace_extension(Storage, EXESuffix); return Storage.str(); } @@ -473,7 +478,7 @@ GCC::FileType LLC::OutputCode(const std::string &Bitcode, SmallString<128> UniqueFile; error_code EC = - sys::fs::unique_file(Bitcode + "-%%%%%%%" + Suffix, UniqueFile); + sys::fs::createUniqueFile(Bitcode + "-%%%%%%%" + Suffix, UniqueFile); if (EC) { errs() << "Error making unique filename: " << EC.message() << "\n"; exit(1); @@ -710,7 +715,7 @@ int GCC::ExecuteProgram(const std::string &ProgramFile, SmallString<128> OutputBinary; error_code EC = - sys::fs::unique_file(ProgramFile+ "-%%%%%%%.gcc.exe", OutputBinary); + sys::fs::createUniqueFile(ProgramFile + "-%%%%%%%.gcc.exe", OutputBinary); if (EC) { errs() << "Error making unique filename: " << EC.message() << "\n"; exit(1); @@ -819,8 +824,8 @@ int GCC::MakeSharedObject(const std::string &InputFile, FileType fileType, const std::vector &ArgsForGCC, std::string &Error) { SmallString<128> UniqueFilename; - error_code EC = sys::fs::unique_file(InputFile + "-%%%%%%%" + LTDL_SHLIB_EXT, - UniqueFilename); + error_code EC = sys::fs::createUniqueFile( + InputFile + "-%%%%%%%" + LTDL_SHLIB_EXT, UniqueFilename); if (EC) { errs() << "Error making unique filename: " << EC.message() << "\n"; exit(1);