mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-23 14:25:07 +00:00
Don't silently ignore errors when opening output streams.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55120 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -125,7 +125,14 @@ static raw_ostream *GetOutputStream(const char *ProgName) {
|
|||||||
sys::RemoveFileOnSignal(sys::Path(OutputFilename));
|
sys::RemoveFileOnSignal(sys::Path(OutputFilename));
|
||||||
|
|
||||||
std::string error;
|
std::string error;
|
||||||
return new raw_fd_ostream(OutputFilename.c_str(), error);
|
raw_ostream *Out = new raw_fd_ostream(OutputFilename.c_str(), error);
|
||||||
|
if (!error.empty()) {
|
||||||
|
std::cerr << error << '\n';
|
||||||
|
delete Out;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InputFilename == "-") {
|
if (InputFilename == "-") {
|
||||||
@@ -170,7 +177,7 @@ static raw_ostream *GetOutputStream(const char *ProgName) {
|
|||||||
std::string error;
|
std::string error;
|
||||||
raw_ostream *Out = new raw_fd_ostream(OutputFilename.c_str(), error);
|
raw_ostream *Out = new raw_fd_ostream(OutputFilename.c_str(), error);
|
||||||
if (!error.empty()) {
|
if (!error.empty()) {
|
||||||
std::cerr << error;
|
std::cerr << error << '\n';
|
||||||
delete Out;
|
delete Out;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -163,10 +163,11 @@ const void* LTOCodeGenerator::compile(size_t* length, std::string& errMsg)
|
|||||||
sys::RemoveFileOnSignal(uniqueAsmPath);
|
sys::RemoveFileOnSignal(uniqueAsmPath);
|
||||||
|
|
||||||
// generate assembly code
|
// generate assembly code
|
||||||
std::string error;
|
|
||||||
bool genResult = false;
|
bool genResult = false;
|
||||||
{
|
{
|
||||||
raw_fd_ostream asmFile(uniqueAsmPath.c_str(), error);
|
raw_fd_ostream asmFile(uniqueAsmPath.c_str(), errMsg);
|
||||||
|
if (!errMsg.empty())
|
||||||
|
return NULL;
|
||||||
genResult = this->generateAssemblyCode(asmFile, errMsg);
|
genResult = this->generateAssemblyCode(asmFile, errMsg);
|
||||||
}
|
}
|
||||||
if ( genResult ) {
|
if ( genResult ) {
|
||||||
|
Reference in New Issue
Block a user