mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-20 10:24:12 +00:00
Use the new tool_output_file in several tools. This fixes a variety
of problems with output files being left behind or output streams being left unclosed. Fix llvm-mc to respect the -o option in all modes, rather than hardcoding outs() in some cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111603 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -68,15 +68,10 @@ static void WriteOutputFile(const Module *M) {
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure that the Out file gets unlinked from the disk if we get a
|
||||
// SIGINT.
|
||||
if (OutputFilename != "-")
|
||||
sys::RemoveFileOnSignal(sys::Path(OutputFilename));
|
||||
|
||||
std::string ErrorInfo;
|
||||
std::auto_ptr<raw_ostream> Out
|
||||
(new raw_fd_ostream(OutputFilename.c_str(), ErrorInfo,
|
||||
raw_fd_ostream::F_Binary));
|
||||
OwningPtr<tool_output_file> Out
|
||||
(new tool_output_file(OutputFilename.c_str(), ErrorInfo,
|
||||
raw_fd_ostream::F_Binary));
|
||||
if (!ErrorInfo.empty()) {
|
||||
errs() << ErrorInfo << '\n';
|
||||
exit(1);
|
||||
@ -84,6 +79,9 @@ static void WriteOutputFile(const Module *M) {
|
||||
|
||||
if (Force || !CheckBitcodeOutputToConsole(*Out, true))
|
||||
WriteBitcodeToFile(M, *Out);
|
||||
|
||||
// Declare success.
|
||||
Out->keep();
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
Reference in New Issue
Block a user