mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-23 02:29:18 +00:00
llvm-c: Don't assert in LLVMTargetMachineEmitToFile on nonexistent file
Error handling code for raw_fd_ostream constructor is present, but never used, because formatted_raw_ostream will always assert on closed fd's before. Patch by Peter Zotov Differential Revision: http://llvm-reviews.chandlerc.com/D1909 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192881 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ed785629be
commit
0738387d08
@ -205,11 +205,11 @@ LLVMBool LLVMTargetMachineEmitToFile(LLVMTargetMachineRef T, LLVMModuleRef M,
|
||||
char* Filename, LLVMCodeGenFileType codegen, char** ErrorMessage) {
|
||||
std::string error;
|
||||
raw_fd_ostream dest(Filename, error, sys::fs::F_Binary);
|
||||
formatted_raw_ostream destf(dest);
|
||||
if (!error.empty()) {
|
||||
*ErrorMessage = strdup(error.c_str());
|
||||
return true;
|
||||
}
|
||||
formatted_raw_ostream destf(dest);
|
||||
bool Result = LLVMTargetMachineEmit(T, M, destf, codegen, ErrorMessage);
|
||||
dest.flush();
|
||||
return Result;
|
||||
|
Loading…
Reference in New Issue
Block a user