diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/llc/llc.cpp | 11 | ||||
-rw-r--r-- | tools/lto/LTOCodeGenerator.cpp | 5 |
2 files changed, 12 insertions, 4 deletions
diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp index 2c725e8..03972b1 100644 --- a/tools/llc/llc.cpp +++ b/tools/llc/llc.cpp @@ -125,7 +125,14 @@ static raw_ostream *GetOutputStream(const char *ProgName) { sys::RemoveFileOnSignal(sys::Path(OutputFilename)); 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 == "-") { @@ -170,7 +177,7 @@ static raw_ostream *GetOutputStream(const char *ProgName) { std::string error; raw_ostream *Out = new raw_fd_ostream(OutputFilename.c_str(), error); if (!error.empty()) { - std::cerr << error; + std::cerr << error << '\n'; delete Out; return 0; } diff --git a/tools/lto/LTOCodeGenerator.cpp b/tools/lto/LTOCodeGenerator.cpp index 275aac2..c035be9 100644 --- a/tools/lto/LTOCodeGenerator.cpp +++ b/tools/lto/LTOCodeGenerator.cpp @@ -163,10 +163,11 @@ const void* LTOCodeGenerator::compile(size_t* length, std::string& errMsg) sys::RemoveFileOnSignal(uniqueAsmPath); // generate assembly code - std::string error; 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); } if ( genResult ) { |