[llvm-commits] CVS: llvm/lib/Support/ToolRunner.cpp
Reid Spencer
reid at x10sys.com
Thu Dec 16 15:01:44 PST 2004
Changes in directory llvm/lib/Support:
ToolRunner.cpp updated: 1.35 -> 1.36
---
Log message:
For PR351: http://llvm.cs.uiuc.edu/PR351 :
* Make the OutputC and OutputAsm functions work with sys::Path for the output
file name instead of using std::string.
* Get rid of extraneous "toString" calls.
* Change "removeFile" to sys::Path::destroyFile()
---
Diffs of the changes: (+14 -15)
Index: llvm/lib/Support/ToolRunner.cpp
diff -u llvm/lib/Support/ToolRunner.cpp:1.35 llvm/lib/Support/ToolRunner.cpp:1.36
--- llvm/lib/Support/ToolRunner.cpp:1.35 Tue Dec 14 19:51:56 2004
+++ llvm/lib/Support/ToolRunner.cpp Thu Dec 16 17:01:34 2004
@@ -44,7 +44,7 @@
ErrorFile.close();
}
- removeFile(ErrorFilename.toString());
+ ErrorFilename.destroyFile();
throw ToolExecutionError(OS.str());
}
@@ -123,10 +123,10 @@
//===----------------------------------------------------------------------===//
// LLC Implementation of AbstractIntepreter interface
//
-void LLC::OutputAsm(const std::string &Bytecode, std::string &OutputAsmFile) {
+void LLC::OutputAsm(const std::string &Bytecode, sys::Path &OutputAsmFile) {
sys::Path uniqueFile(Bytecode+".llc.s");
uniqueFile.makeUnique();
- OutputAsmFile = uniqueFile.toString();
+ OutputAsmFile = uniqueFile;
std::vector<const char *> LLCArgs;
LLCArgs.push_back (LLCPath.c_str());
@@ -152,9 +152,9 @@
}
void LLC::compileProgram(const std::string &Bytecode) {
- std::string OutputAsmFile;
+ sys::Path OutputAsmFile;
OutputAsm(Bytecode, OutputAsmFile);
- removeFile(OutputAsmFile);
+ OutputAsmFile.destroyFile();
}
int LLC::ExecuteProgram(const std::string &Bytecode,
@@ -164,12 +164,12 @@
const std::vector<std::string> &SharedLibs,
unsigned Timeout) {
- std::string OutputAsmFile;
+ sys::Path OutputAsmFile;
OutputAsm(Bytecode, OutputAsmFile);
FileRemover OutFileRemover(OutputAsmFile);
// Assuming LLC worked, compile the result with GCC and run it.
- return gcc->ExecuteProgram(OutputAsmFile, Args, GCC::AsmFile,
+ return gcc->ExecuteProgram(OutputAsmFile.toString(), Args, GCC::AsmFile,
InputFile, OutputFile, SharedLibs, Timeout);
}
@@ -266,11 +266,10 @@
return 0;
}
-void CBE::OutputC(const std::string &Bytecode,
- std::string &OutputCFile) {
+void CBE::OutputC(const std::string &Bytecode, sys::Path& OutputCFile) {
sys::Path uniqueFile(Bytecode+".cbe.c");
uniqueFile.makeUnique();
- OutputCFile = uniqueFile.toString();
+ OutputCFile = uniqueFile;
std::vector<const char *> LLCArgs;
LLCArgs.push_back (LLCPath.c_str());
@@ -297,9 +296,9 @@
}
void CBE::compileProgram(const std::string &Bytecode) {
- std::string OutputCFile;
+ sys::Path OutputCFile;
OutputC(Bytecode, OutputCFile);
- removeFile(OutputCFile);
+ OutputCFile.destroyFile();
}
int CBE::ExecuteProgram(const std::string &Bytecode,
@@ -308,12 +307,12 @@
const std::string &OutputFile,
const std::vector<std::string> &SharedLibs,
unsigned Timeout) {
- std::string OutputCFile;
+ sys::Path OutputCFile;
OutputC(Bytecode, OutputCFile);
FileRemover CFileRemove(OutputCFile);
- return gcc->ExecuteProgram(OutputCFile, Args, GCC::CFile,
+ return gcc->ExecuteProgram(OutputCFile.toString(), Args, GCC::CFile,
InputFile, OutputFile, SharedLibs, Timeout);
}
@@ -398,7 +397,7 @@
std::cerr << "\n";
);
- FileRemover OutputBinaryRemover(OutputBinary.toString());
+ FileRemover OutputBinaryRemover(OutputBinary);
return RunProgramWithTimeout(OutputBinary.toString(), &ProgramArgs[0],
InputFile, OutputFile, OutputFile, Timeout);
}
More information about the llvm-commits
mailing list