mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-03 13:31:05 +00:00
For PR351:
* Remove #inclusion of FileUtilities.h, not needed any more. * Convert getUniqueFilename -> sys::Pat::makeUnique() git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18948 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c29befb554
commit
cda985e191
@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
#include "ArchiveInternals.h"
|
#include "ArchiveInternals.h"
|
||||||
#include "llvm/Bytecode/Reader.h"
|
#include "llvm/Bytecode/Reader.h"
|
||||||
#include "llvm/Support/FileUtilities.h"
|
|
||||||
#include "llvm/Support/Compressor.h"
|
#include "llvm/Support/Compressor.h"
|
||||||
#include "llvm/System/Signals.h"
|
#include "llvm/System/Signals.h"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
#include "ArchiveInternals.h"
|
#include "ArchiveInternals.h"
|
||||||
#include "llvm/Bytecode/Reader.h"
|
#include "llvm/Bytecode/Reader.h"
|
||||||
#include "llvm/Support/FileUtilities.h"
|
|
||||||
#include "llvm/Support/Compressor.h"
|
#include "llvm/Support/Compressor.h"
|
||||||
#include "llvm/System/Signals.h"
|
#include "llvm/System/Signals.h"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/Debugger/SourceFile.h"
|
#include "llvm/Debugger/SourceFile.h"
|
||||||
#include "llvm/Debugger/SourceLanguage.h"
|
#include "llvm/Debugger/SourceLanguage.h"
|
||||||
#include "llvm/Support/FileUtilities.h"
|
|
||||||
#include "llvm/Support/SlowOperationInformer.h"
|
#include "llvm/Support/SlowOperationInformer.h"
|
||||||
#include "llvm/ADT/STLExtras.h"
|
#include "llvm/ADT/STLExtras.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
#include "llvm/Debugger/SourceFile.h"
|
#include "llvm/Debugger/SourceFile.h"
|
||||||
#include "llvm/Support/SlowOperationInformer.h"
|
#include "llvm/Support/SlowOperationInformer.h"
|
||||||
#include "llvm/Support/FileUtilities.h"
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
@ -30,7 +30,8 @@ static void ProcessFailure(std::string ProgPath, const char** Args) {
|
|||||||
OS << "\n";
|
OS << "\n";
|
||||||
|
|
||||||
// Rerun the compiler, capturing any error messages to print them.
|
// Rerun the compiler, capturing any error messages to print them.
|
||||||
std::string ErrorFilename = getUniqueFilename("error_messages");
|
sys::Path ErrorFilename("error_messages");
|
||||||
|
ErrorFilename.makeUnique();
|
||||||
RunProgramWithTimeout(ProgPath, Args, "/dev/null", ErrorFilename.c_str(),
|
RunProgramWithTimeout(ProgPath, Args, "/dev/null", ErrorFilename.c_str(),
|
||||||
ErrorFilename.c_str());
|
ErrorFilename.c_str());
|
||||||
|
|
||||||
@ -43,7 +44,7 @@ static void ProcessFailure(std::string ProgPath, const char** Args) {
|
|||||||
ErrorFile.close();
|
ErrorFile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
removeFile(ErrorFilename);
|
removeFile(ErrorFilename.toString());
|
||||||
throw ToolExecutionError(OS.str());
|
throw ToolExecutionError(OS.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +124,9 @@ AbstractInterpreter *AbstractInterpreter::createLLI(const std::string &ProgPath,
|
|||||||
// LLC Implementation of AbstractIntepreter interface
|
// LLC Implementation of AbstractIntepreter interface
|
||||||
//
|
//
|
||||||
void LLC::OutputAsm(const std::string &Bytecode, std::string &OutputAsmFile) {
|
void LLC::OutputAsm(const std::string &Bytecode, std::string &OutputAsmFile) {
|
||||||
OutputAsmFile = getUniqueFilename(Bytecode+".llc.s");
|
sys::Path uniqueFile(Bytecode+".llc.s");
|
||||||
|
uniqueFile.makeUnique();
|
||||||
|
OutputAsmFile = uniqueFile.toString();
|
||||||
std::vector<const char *> LLCArgs;
|
std::vector<const char *> LLCArgs;
|
||||||
LLCArgs.push_back (LLCPath.c_str());
|
LLCArgs.push_back (LLCPath.c_str());
|
||||||
|
|
||||||
@ -265,7 +268,9 @@ AbstractInterpreter *AbstractInterpreter::createJIT(const std::string &ProgPath,
|
|||||||
|
|
||||||
void CBE::OutputC(const std::string &Bytecode,
|
void CBE::OutputC(const std::string &Bytecode,
|
||||||
std::string &OutputCFile) {
|
std::string &OutputCFile) {
|
||||||
OutputCFile = getUniqueFilename(Bytecode+".cbe.c");
|
sys::Path uniqueFile(Bytecode+".cbe.c");
|
||||||
|
uniqueFile.makeUnique();
|
||||||
|
OutputCFile = uniqueFile.toString();
|
||||||
std::vector<const char *> LLCArgs;
|
std::vector<const char *> LLCArgs;
|
||||||
LLCArgs.push_back (LLCPath.c_str());
|
LLCArgs.push_back (LLCPath.c_str());
|
||||||
|
|
||||||
@ -361,7 +366,8 @@ int GCC::ExecuteProgram(const std::string &ProgramFile,
|
|||||||
}
|
}
|
||||||
GCCArgs.push_back(ProgramFile.c_str()); // Specify the input filename...
|
GCCArgs.push_back(ProgramFile.c_str()); // Specify the input filename...
|
||||||
GCCArgs.push_back("-o");
|
GCCArgs.push_back("-o");
|
||||||
std::string OutputBinary = getUniqueFilename(ProgramFile+".gcc.exe");
|
sys::Path OutputBinary (ProgramFile+".gcc.exe");
|
||||||
|
OutputBinary.makeUnique();
|
||||||
GCCArgs.push_back(OutputBinary.c_str()); // Output to the right file...
|
GCCArgs.push_back(OutputBinary.c_str()); // Output to the right file...
|
||||||
GCCArgs.push_back("-lm"); // Hard-code the math library...
|
GCCArgs.push_back("-lm"); // Hard-code the math library...
|
||||||
GCCArgs.push_back("-O2"); // Optimize the program a bit...
|
GCCArgs.push_back("-O2"); // Optimize the program a bit...
|
||||||
@ -392,14 +398,17 @@ int GCC::ExecuteProgram(const std::string &ProgramFile,
|
|||||||
std::cerr << "\n";
|
std::cerr << "\n";
|
||||||
);
|
);
|
||||||
|
|
||||||
FileRemover OutputBinaryRemover(OutputBinary);
|
FileRemover OutputBinaryRemover(OutputBinary.toString());
|
||||||
return RunProgramWithTimeout(OutputBinary, &ProgramArgs[0],
|
return RunProgramWithTimeout(OutputBinary.toString(), &ProgramArgs[0],
|
||||||
InputFile, OutputFile, OutputFile, Timeout);
|
InputFile, OutputFile, OutputFile, Timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
int GCC::MakeSharedObject(const std::string &InputFile, FileType fileType,
|
int GCC::MakeSharedObject(const std::string &InputFile, FileType fileType,
|
||||||
std::string &OutputFile) {
|
std::string &OutputFile) {
|
||||||
OutputFile = getUniqueFilename(InputFile+LTDL_SHLIB_EXT);
|
sys::Path uniqueFilename(InputFile+LTDL_SHLIB_EXT);
|
||||||
|
uniqueFilename.makeUnique();
|
||||||
|
OutputFile = uniqueFilename.toString();
|
||||||
|
|
||||||
// Compile the C/asm file into a shared object
|
// Compile the C/asm file into a shared object
|
||||||
const char* GCCArgs[] = {
|
const char* GCCArgs[] = {
|
||||||
GCCPath.c_str(),
|
GCCPath.c_str(),
|
||||||
|
@ -30,7 +30,8 @@ static void ProcessFailure(std::string ProgPath, const char** Args) {
|
|||||||
OS << "\n";
|
OS << "\n";
|
||||||
|
|
||||||
// Rerun the compiler, capturing any error messages to print them.
|
// Rerun the compiler, capturing any error messages to print them.
|
||||||
std::string ErrorFilename = getUniqueFilename("error_messages");
|
sys::Path ErrorFilename("error_messages");
|
||||||
|
ErrorFilename.makeUnique();
|
||||||
RunProgramWithTimeout(ProgPath, Args, "/dev/null", ErrorFilename.c_str(),
|
RunProgramWithTimeout(ProgPath, Args, "/dev/null", ErrorFilename.c_str(),
|
||||||
ErrorFilename.c_str());
|
ErrorFilename.c_str());
|
||||||
|
|
||||||
@ -43,7 +44,7 @@ static void ProcessFailure(std::string ProgPath, const char** Args) {
|
|||||||
ErrorFile.close();
|
ErrorFile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
removeFile(ErrorFilename);
|
removeFile(ErrorFilename.toString());
|
||||||
throw ToolExecutionError(OS.str());
|
throw ToolExecutionError(OS.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +124,9 @@ AbstractInterpreter *AbstractInterpreter::createLLI(const std::string &ProgPath,
|
|||||||
// LLC Implementation of AbstractIntepreter interface
|
// LLC Implementation of AbstractIntepreter interface
|
||||||
//
|
//
|
||||||
void LLC::OutputAsm(const std::string &Bytecode, std::string &OutputAsmFile) {
|
void LLC::OutputAsm(const std::string &Bytecode, std::string &OutputAsmFile) {
|
||||||
OutputAsmFile = getUniqueFilename(Bytecode+".llc.s");
|
sys::Path uniqueFile(Bytecode+".llc.s");
|
||||||
|
uniqueFile.makeUnique();
|
||||||
|
OutputAsmFile = uniqueFile.toString();
|
||||||
std::vector<const char *> LLCArgs;
|
std::vector<const char *> LLCArgs;
|
||||||
LLCArgs.push_back (LLCPath.c_str());
|
LLCArgs.push_back (LLCPath.c_str());
|
||||||
|
|
||||||
@ -265,7 +268,9 @@ AbstractInterpreter *AbstractInterpreter::createJIT(const std::string &ProgPath,
|
|||||||
|
|
||||||
void CBE::OutputC(const std::string &Bytecode,
|
void CBE::OutputC(const std::string &Bytecode,
|
||||||
std::string &OutputCFile) {
|
std::string &OutputCFile) {
|
||||||
OutputCFile = getUniqueFilename(Bytecode+".cbe.c");
|
sys::Path uniqueFile(Bytecode+".cbe.c");
|
||||||
|
uniqueFile.makeUnique();
|
||||||
|
OutputCFile = uniqueFile.toString();
|
||||||
std::vector<const char *> LLCArgs;
|
std::vector<const char *> LLCArgs;
|
||||||
LLCArgs.push_back (LLCPath.c_str());
|
LLCArgs.push_back (LLCPath.c_str());
|
||||||
|
|
||||||
@ -361,7 +366,8 @@ int GCC::ExecuteProgram(const std::string &ProgramFile,
|
|||||||
}
|
}
|
||||||
GCCArgs.push_back(ProgramFile.c_str()); // Specify the input filename...
|
GCCArgs.push_back(ProgramFile.c_str()); // Specify the input filename...
|
||||||
GCCArgs.push_back("-o");
|
GCCArgs.push_back("-o");
|
||||||
std::string OutputBinary = getUniqueFilename(ProgramFile+".gcc.exe");
|
sys::Path OutputBinary (ProgramFile+".gcc.exe");
|
||||||
|
OutputBinary.makeUnique();
|
||||||
GCCArgs.push_back(OutputBinary.c_str()); // Output to the right file...
|
GCCArgs.push_back(OutputBinary.c_str()); // Output to the right file...
|
||||||
GCCArgs.push_back("-lm"); // Hard-code the math library...
|
GCCArgs.push_back("-lm"); // Hard-code the math library...
|
||||||
GCCArgs.push_back("-O2"); // Optimize the program a bit...
|
GCCArgs.push_back("-O2"); // Optimize the program a bit...
|
||||||
@ -392,14 +398,17 @@ int GCC::ExecuteProgram(const std::string &ProgramFile,
|
|||||||
std::cerr << "\n";
|
std::cerr << "\n";
|
||||||
);
|
);
|
||||||
|
|
||||||
FileRemover OutputBinaryRemover(OutputBinary);
|
FileRemover OutputBinaryRemover(OutputBinary.toString());
|
||||||
return RunProgramWithTimeout(OutputBinary, &ProgramArgs[0],
|
return RunProgramWithTimeout(OutputBinary.toString(), &ProgramArgs[0],
|
||||||
InputFile, OutputFile, OutputFile, Timeout);
|
InputFile, OutputFile, OutputFile, Timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
int GCC::MakeSharedObject(const std::string &InputFile, FileType fileType,
|
int GCC::MakeSharedObject(const std::string &InputFile, FileType fileType,
|
||||||
std::string &OutputFile) {
|
std::string &OutputFile) {
|
||||||
OutputFile = getUniqueFilename(InputFile+LTDL_SHLIB_EXT);
|
sys::Path uniqueFilename(InputFile+LTDL_SHLIB_EXT);
|
||||||
|
uniqueFilename.makeUnique();
|
||||||
|
OutputFile = uniqueFilename.toString();
|
||||||
|
|
||||||
// Compile the C/asm file into a shared object
|
// Compile the C/asm file into a shared object
|
||||||
const char* GCCArgs[] = {
|
const char* GCCArgs[] = {
|
||||||
GCCPath.c_str(),
|
GCCPath.c_str(),
|
||||||
|
Loading…
Reference in New Issue
Block a user