mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-12 13:38:21 +00:00
Convert tools to use tool_output_file, and introduce error
checking to places which previously lacked it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111651 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -155,8 +155,8 @@ bool LTOCodeGenerator::writeMergedModules(const char *path,
|
||||
|
||||
// create output file
|
||||
std::string ErrInfo;
|
||||
raw_fd_ostream Out(path, ErrInfo,
|
||||
raw_fd_ostream::F_Binary);
|
||||
tool_output_file Out(path, ErrInfo,
|
||||
raw_fd_ostream::F_Binary);
|
||||
if (!ErrInfo.empty()) {
|
||||
errMsg = "could not open bitcode file for writing: ";
|
||||
errMsg += path;
|
||||
@ -174,6 +174,7 @@ bool LTOCodeGenerator::writeMergedModules(const char *path,
|
||||
return true;
|
||||
}
|
||||
|
||||
Out.keep();
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -189,11 +190,17 @@ const void* LTOCodeGenerator::compile(size_t* length, std::string& errMsg)
|
||||
// generate assembly code
|
||||
bool genResult = false;
|
||||
{
|
||||
raw_fd_ostream asmFD(uniqueAsmPath.c_str(), errMsg);
|
||||
formatted_raw_ostream asmFile(asmFD);
|
||||
tool_output_file asmFD(uniqueAsmPath.c_str(), errMsg);
|
||||
formatted_tool_output_file asmFile(asmFD);
|
||||
if (!errMsg.empty())
|
||||
return NULL;
|
||||
genResult = this->generateAssemblyCode(asmFile, errMsg);
|
||||
asmFile.close();
|
||||
if (asmFile.has_error()) {
|
||||
asmFile.clear_error();
|
||||
return NULL;
|
||||
}
|
||||
asmFile.keep();
|
||||
}
|
||||
if ( genResult ) {
|
||||
uniqueAsmPath.eraseFromDisk();
|
||||
|
Reference in New Issue
Block a user