diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2004-12-16 23:04:20 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2004-12-16 23:04:20 +0000 |
commit | 5f76760c880e6d61c229d2058c5699b033caeae1 (patch) | |
tree | 0afc79386ae09a712ea3dbd7fc4208d20d422eb9 /tools/bugpoint/ExecutionDriver.cpp | |
parent | 9ac141823d6180f8a49299c55ed8fc8b9a8310a3 (diff) | |
download | external_llvm-5f76760c880e6d61c229d2058c5699b033caeae1.zip external_llvm-5f76760c880e6d61c229d2058c5699b033caeae1.tar.gz external_llvm-5f76760c880e6d61c229d2058c5699b033caeae1.tar.bz2 |
For PR351:
* removeFile() -> sys::Path::destroyFile()
* remove extraneous toString() calls
* convert local variables representing path names from std::string to
sys::Path
* Use sys::Path objects with FileRemove instead of std::string
* Use sys::Path methods for construction of path names
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19001 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint/ExecutionDriver.cpp')
-rw-r--r-- | tools/bugpoint/ExecutionDriver.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/tools/bugpoint/ExecutionDriver.cpp b/tools/bugpoint/ExecutionDriver.cpp index fbba687..8044f50 100644 --- a/tools/bugpoint/ExecutionDriver.cpp +++ b/tools/bugpoint/ExecutionDriver.cpp @@ -161,7 +161,7 @@ void BugDriver::compileProgram(Module *M) { } // Remove the temporary bytecode file when we are done. - FileRemover BytecodeFileRemover(BytecodeFile.toString()); + FileRemover BytecodeFileRemover(BytecodeFile); // Actually compile the program! Interpreter->compileProgram(BytecodeFile.toString()); @@ -195,7 +195,7 @@ std::string BugDriver::executeProgram(std::string OutputFile, } // Remove the temporary bytecode file when we are done. - FileRemover BytecodeFileRemover(BytecodeFile, CreatedBytecode); + FileRemover BytecodeFileRemover(sys::Path(BytecodeFile), CreatedBytecode); if (OutputFile.empty()) OutputFile = "bugpoint-execution-output"; @@ -252,7 +252,7 @@ std::string BugDriver::executeProgramWithCBE(std::string OutputFile) { std::string BugDriver::compileSharedObject(const std::string &BytecodeFile) { assert(Interpreter && "Interpreter should have been created already!"); - std::string OutputCFile; + sys::Path OutputCFile; // Using CBE cbe->OutputC(BytecodeFile, OutputCFile); @@ -268,11 +268,12 @@ std::string BugDriver::compileSharedObject(const std::string &BytecodeFile) { #endif std::string SharedObjectFile; - if (gcc->MakeSharedObject(OutputCFile, GCC::CFile, SharedObjectFile)) + if (gcc->MakeSharedObject(OutputCFile.toString(), GCC::CFile, + SharedObjectFile)) exit(1); // Remove the intermediate C file - removeFile(OutputCFile); + OutputCFile.destroyFile(); return "./" + SharedObjectFile; } @@ -288,19 +289,20 @@ bool BugDriver::diffProgram(const std::string &BytecodeFile, bool ProgramExitedNonzero; // Execute the program, generating an output file... - std::string Output = executeProgram("", BytecodeFile, SharedObject, 0, - &ProgramExitedNonzero); + sys::Path Output (executeProgram("", BytecodeFile, SharedObject, 0, + &ProgramExitedNonzero)); // If we're checking the program exit code, assume anything nonzero is bad. if (CheckProgramExitCode && ProgramExitedNonzero) { - removeFile(Output); - if (RemoveBytecode) removeFile(BytecodeFile); + Output.destroyFile(); + if (RemoveBytecode) + sys::Path(BytecodeFile).destroyFile(); return true; } std::string Error; bool FilesDifferent = false; - if (DiffFiles(ReferenceOutputFile, Output, &Error)) { + if (DiffFiles(ReferenceOutputFile, Output.toString(), &Error)) { if (!Error.empty()) { std::cerr << "While diffing output: " << Error << '\n'; exit(1); @@ -309,10 +311,10 @@ bool BugDriver::diffProgram(const std::string &BytecodeFile, } // Remove the generated output. - removeFile(Output); + Output.destroyFile(); // Remove the bytecode file if we are supposed to. - if (RemoveBytecode) removeFile(BytecodeFile); + if (RemoveBytecode) sys::Path(BytecodeFile).destroyFile(); return FilesDifferent; } |