diff options
author | Dan Gohman <gohman@apple.com> | 2010-08-20 01:07:01 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-08-20 01:07:01 +0000 |
commit | 268b0f4781a47645c2738e08cfb2da4ae5e4599f (patch) | |
tree | aa49a2a339561ccb9c94ee959dc96cd39f4e437b /llvm/tools/llvm-as/llvm-as.cpp | |
parent | 796b5122d936a798bbef4c7aae558aca7400a152 (diff) | |
download | bcm5719-llvm-268b0f4781a47645c2738e08cfb2da4ae5e4599f.tar.gz bcm5719-llvm-268b0f4781a47645c2738e08cfb2da4ae5e4599f.zip |
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.
llvm-svn: 111603
Diffstat (limited to 'llvm/tools/llvm-as/llvm-as.cpp')
-rw-r--r-- | llvm/tools/llvm-as/llvm-as.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/llvm/tools/llvm-as/llvm-as.cpp b/llvm/tools/llvm-as/llvm-as.cpp index d39d6c8a31f..516cec2d5c9 100644 --- a/llvm/tools/llvm-as/llvm-as.cpp +++ b/llvm/tools/llvm-as/llvm-as.cpp @@ -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) { |