[llvm-commits] CVS: llvm/tools/bugpoint/ExecutionDriver.cpp Miscompilation.cpp OptimizerDriver.cpp ToolRunner.cpp
Reid Spencer
reid at x10sys.com
Wed Aug 23 13:35:17 PDT 2006
Changes in directory llvm/tools/bugpoint:
ExecutionDriver.cpp updated: 1.63 -> 1.64
Miscompilation.cpp updated: 1.75 -> 1.76
OptimizerDriver.cpp updated: 1.42 -> 1.43
ToolRunner.cpp updated: 1.56 -> 1.57
---
Log message:
For PR797: http://llvm.org/PR797 :
Final removal of exceptions from lib/System and adjustment of users to
accommodate.
---
Diffs of the changes: (+75 -15)
ExecutionDriver.cpp | 20 +++++++++++++++++---
Miscompilation.cpp | 26 ++++++++++++++++++++++----
OptimizerDriver.cpp | 14 +++++++++++---
ToolRunner.cpp | 30 +++++++++++++++++++++++++-----
4 files changed, 75 insertions(+), 15 deletions(-)
Index: llvm/tools/bugpoint/ExecutionDriver.cpp
diff -u llvm/tools/bugpoint/ExecutionDriver.cpp:1.63 llvm/tools/bugpoint/ExecutionDriver.cpp:1.64
--- llvm/tools/bugpoint/ExecutionDriver.cpp:1.63 Tue Aug 15 11:40:49 2006
+++ llvm/tools/bugpoint/ExecutionDriver.cpp Wed Aug 23 15:34:57 2006
@@ -161,7 +161,12 @@
void BugDriver::compileProgram(Module *M) {
// Emit the program to a bytecode file...
sys::Path BytecodeFile ("bugpoint-test-program.bc");
- BytecodeFile.makeUnique();
+ std::string ErrMsg;
+ if (BytecodeFile.makeUnique(true,&ErrMsg)) {
+ std::cerr << ToolName << ": Error making unique filename: " << ErrMsg
+ << "\n";
+ exit(1);
+ }
if (writeProgramToFile(BytecodeFile.toString(), M)) {
std::cerr << ToolName << ": Error emitting bytecode to file '"
<< BytecodeFile << "'!\n";
@@ -188,10 +193,15 @@
if (AI == 0) AI = Interpreter;
assert(AI && "Interpreter should have been created already!");
bool CreatedBytecode = false;
+ std::string ErrMsg;
if (BytecodeFile.empty()) {
// Emit the program to a bytecode file...
sys::Path uniqueFilename("bugpoint-test-program.bc");
- uniqueFilename.makeUnique();
+ if (uniqueFilename.makeUnique(true, &ErrMsg)) {
+ std::cerr << ToolName << ": Error making unique filename: "
+ << ErrMsg << "!\n";
+ exit(1);
+ }
BytecodeFile = uniqueFilename.toString();
if (writeProgramToFile(BytecodeFile, Program)) {
@@ -210,7 +220,11 @@
// Check to see if this is a valid output filename...
sys::Path uniqueFile(OutputFile);
- uniqueFile.makeUnique();
+ if (uniqueFile.makeUnique(true, &ErrMsg)) {
+ std::cerr << ToolName << ": Error making unique filename: "
+ << ErrMsg << "\n";
+ exit(1);
+ }
OutputFile = uniqueFile.toString();
// Figure out which shared objects to run, if any.
Index: llvm/tools/bugpoint/Miscompilation.cpp
diff -u llvm/tools/bugpoint/Miscompilation.cpp:1.75 llvm/tools/bugpoint/Miscompilation.cpp:1.76
--- llvm/tools/bugpoint/Miscompilation.cpp:1.75 Thu May 4 18:35:31 2006
+++ llvm/tools/bugpoint/Miscompilation.cpp Wed Aug 23 15:34:57 2006
@@ -776,7 +776,12 @@
CleanupAndPrepareModules(BD, Test, Safe);
sys::Path TestModuleBC("bugpoint.test.bc");
- TestModuleBC.makeUnique();
+ std::string ErrMsg;
+ if (TestModuleBC.makeUnique(true, &ErrMsg)) {
+ std::cerr << BD.getToolName() << "Error making unique filename: "
+ << ErrMsg << "\n";
+ exit(1);
+ }
if (BD.writeProgramToFile(TestModuleBC.toString(), Test)) {
std::cerr << "Error writing bytecode to `" << TestModuleBC << "'\nExiting.";
exit(1);
@@ -785,7 +790,11 @@
// Make the shared library
sys::Path SafeModuleBC("bugpoint.safe.bc");
- SafeModuleBC.makeUnique();
+ if (SafeModuleBC.makeUnique(true, &ErrMsg)) {
+ std::cerr << BD.getToolName() << "Error making unique filename: "
+ << ErrMsg << "\n";
+ exit(1);
+ }
if (BD.writeProgramToFile(SafeModuleBC.toString(), Safe)) {
std::cerr << "Error writing bytecode to `" << SafeModuleBC << "'\nExiting.";
@@ -836,7 +845,12 @@
CleanupAndPrepareModules(*this, ToCodeGen, ToNotCodeGen);
sys::Path TestModuleBC("bugpoint.test.bc");
- TestModuleBC.makeUnique();
+ std::string ErrMsg;
+ if (TestModuleBC.makeUnique(true, &ErrMsg)) {
+ std::cerr << getToolName() << "Error making unique filename: "
+ << ErrMsg << "\n";
+ exit(1);
+ }
if (writeProgramToFile(TestModuleBC.toString(), ToCodeGen)) {
std::cerr << "Error writing bytecode to `" << TestModuleBC << "'\nExiting.";
@@ -846,7 +860,11 @@
// Make the shared library
sys::Path SafeModuleBC("bugpoint.safe.bc");
- SafeModuleBC.makeUnique();
+ if (SafeModuleBC.makeUnique(true, &ErrMsg)) {
+ std::cerr << getToolName() << "Error making unique filename: "
+ << ErrMsg << "\n";
+ exit(1);
+ }
if (writeProgramToFile(SafeModuleBC.toString(), ToNotCodeGen)) {
std::cerr << "Error writing bytecode to `" << SafeModuleBC << "'\nExiting.";
Index: llvm/tools/bugpoint/OptimizerDriver.cpp
diff -u llvm/tools/bugpoint/OptimizerDriver.cpp:1.42 llvm/tools/bugpoint/OptimizerDriver.cpp:1.43
--- llvm/tools/bugpoint/OptimizerDriver.cpp:1.42 Mon Aug 21 01:04:45 2006
+++ llvm/tools/bugpoint/OptimizerDriver.cpp Wed Aug 23 15:34:57 2006
@@ -139,12 +139,21 @@
// setup the output file name
std::cout << std::flush;
sys::Path uniqueFilename("bugpoint-output.bc");
- uniqueFilename.makeUnique();
+ std::string ErrMsg;
+ if (uniqueFilename.makeUnique(true, &ErrMsg)) {
+ std::cerr << getToolName() << ": Error making unique filename: "
+ << ErrMsg << "\n";
+ return(1);
+ }
OutputFilename = uniqueFilename.toString();
// set up the input file name
sys::Path inputFilename("bugpoint-input.bc");
- inputFilename.makeUnique();
+ if (inputFilename.makeUnique(true, &ErrMsg)) {
+ std::cerr << getToolName() << ": Error making unique filename: "
+ << ErrMsg << "\n";
+ return(1);
+ }
std::ios::openmode io_mode = std::ios::out | std::ios::trunc |
std::ios::binary;
std::ofstream InFile(inputFilename.c_str(), io_mode);
@@ -179,7 +188,6 @@
args[n++] = 0;
sys::Path prog(sys::Program::FindProgramByName(ToolName));
- std::string ErrMsg;
int result = sys::Program::ExecuteAndWait(prog,args,0,0,Timeout,&ErrMsg);
// If we are supposed to delete the bytecode file or if the passes crashed,
Index: llvm/tools/bugpoint/ToolRunner.cpp
diff -u llvm/tools/bugpoint/ToolRunner.cpp:1.56 llvm/tools/bugpoint/ToolRunner.cpp:1.57
--- llvm/tools/bugpoint/ToolRunner.cpp:1.56 Mon Aug 21 01:04:45 2006
+++ llvm/tools/bugpoint/ToolRunner.cpp Wed Aug 23 15:34:57 2006
@@ -53,7 +53,11 @@
// Rerun the compiler, capturing any error messages to print them.
sys::Path ErrorFilename("error_messages");
- ErrorFilename.makeUnique();
+ std::string ErrMsg;
+ if (ErrorFilename.makeUnique(true, &ErrMsg)) {
+ std::cerr << "Error making unique filename: " << ErrMsg << "\n";
+ exit(1);
+ }
RunProgramWithTimeout(ProgPath, Args, sys::Path(""), ErrorFilename,
ErrorFilename); // FIXME: check return code ?
@@ -153,7 +157,11 @@
//
void LLC::OutputAsm(const std::string &Bytecode, sys::Path &OutputAsmFile) {
sys::Path uniqueFile(Bytecode+".llc.s");
- uniqueFile.makeUnique();
+ std::string ErrMsg;
+ if (uniqueFile.makeUnique(true, &ErrMsg)) {
+ std::cerr << "Error making unique filename: " << ErrMsg << "\n";
+ exit(1);
+ }
OutputAsmFile = uniqueFile;
std::vector<const char *> LLCArgs;
LLCArgs.push_back (LLCPath.c_str());
@@ -307,7 +315,11 @@
void CBE::OutputC(const std::string &Bytecode, sys::Path& OutputCFile) {
sys::Path uniqueFile(Bytecode+".cbe.c");
- uniqueFile.makeUnique();
+ std::string ErrMsg;
+ if (uniqueFile.makeUnique(true, &ErrMsg)) {
+ std::cerr << "Error making unique filename: " << ErrMsg << "\n";
+ exit(1);
+ }
OutputCFile = uniqueFile;
std::vector<const char *> LLCArgs;
LLCArgs.push_back (LLCPath.c_str());
@@ -409,7 +421,11 @@
GCCArgs.push_back("none");
GCCArgs.push_back("-o");
sys::Path OutputBinary (ProgramFile+".gcc.exe");
- OutputBinary.makeUnique();
+ std::string ErrMsg;
+ if (OutputBinary.makeUnique(true, &ErrMsg)) {
+ std::cerr << "Error making unique filename: " << ErrMsg << "\n";
+ exit(1);
+ }
GCCArgs.push_back(OutputBinary.c_str()); // Output to the right file...
// Add any arguments intended for GCC. We locate them here because this is
@@ -462,7 +478,11 @@
std::string &OutputFile,
const std::vector<std::string> &ArgsForGCC) {
sys::Path uniqueFilename(InputFile+LTDL_SHLIB_EXT);
- uniqueFilename.makeUnique();
+ std::string ErrMsg;
+ if (uniqueFilename.makeUnique(true, &ErrMsg)) {
+ std::cerr << "Error making unique filename: " << ErrMsg << "\n";
+ exit(1);
+ }
OutputFile = uniqueFilename.toString();
std::vector<const char*> GCCArgs;
More information about the llvm-commits
mailing list