// necessarily compile it with GCC and run the program. This throws an
// exception if LLC crashes.
//
- virtual void OutputC(const std::string &Bytecode, std::string &OutputCFile);
+ virtual void OutputC(const std::string &Bytecode, sys::Path& OutputCFile);
};
// not necessarily compile it all the way and run the program. This throws
// an exception if execution of LLC fails.
//
- void OutputAsm(const std::string &Bytecode, std::string &OutputAsmFile);
+ void OutputAsm(const std::string &Bytecode, sys::Path &OutputAsmFile);
};
} // End llvm namespace
ErrorFile.close();
}
- removeFile(ErrorFilename.toString());
+ ErrorFilename.destroyFile();
throw ToolExecutionError(OS.str());
}
//===----------------------------------------------------------------------===//
// 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());
}
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,
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);
}
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());
}
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,
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);
}
std::cerr << "\n";
);
- FileRemover OutputBinaryRemover(OutputBinary.toString());
+ FileRemover OutputBinaryRemover(OutputBinary);
return RunProgramWithTimeout(OutputBinary.toString(), &ProgramArgs[0],
InputFile, OutputFile, OutputFile, Timeout);
}
ErrorFile.close();
}
- removeFile(ErrorFilename.toString());
+ ErrorFilename.destroyFile();
throw ToolExecutionError(OS.str());
}
//===----------------------------------------------------------------------===//
// 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());
}
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,
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);
}
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());
}
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,
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);
}
std::cerr << "\n";
);
- FileRemover OutputBinaryRemover(OutputBinary.toString());
+ FileRemover OutputBinaryRemover(OutputBinary);
return RunProgramWithTimeout(OutputBinary.toString(), &ProgramArgs[0],
InputFile, OutputFile, OutputFile, Timeout);
}
// necessarily compile it with GCC and run the program. This throws an
// exception if LLC crashes.
//
- virtual void OutputC(const std::string &Bytecode, std::string &OutputCFile);
+ virtual void OutputC(const std::string &Bytecode, sys::Path& OutputCFile);
};
// not necessarily compile it all the way and run the program. This throws
// an exception if execution of LLC fails.
//
- void OutputAsm(const std::string &Bytecode, std::string &OutputAsmFile);
+ void OutputAsm(const std::string &Bytecode, sys::Path &OutputAsmFile);
};
} // End llvm namespace