summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-link/llvm-link.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-08-20 01:12:13 +0000
committerDan Gohman <gohman@apple.com>2010-08-20 01:12:13 +0000
commit4cc73ba337ef9c80656bf2e48f7be820d95156d8 (patch)
treea42bc9fce14df3a389467080d4d72f25bd1d77f4 /llvm/tools/llvm-link/llvm-link.cpp
parent268b0f4781a47645c2738e08cfb2da4ae5e4599f (diff)
downloadbcm5719-llvm-4cc73ba337ef9c80656bf2e48f7be820d95156d8.tar.gz
bcm5719-llvm-4cc73ba337ef9c80656bf2e48f7be820d95156d8.zip
Use tool_output_file in llvm-extract and llvm-link too.
llvm-svn: 111604
Diffstat (limited to 'llvm/tools/llvm-link/llvm-link.cpp')
-rw-r--r--llvm/tools/llvm-link/llvm-link.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/llvm/tools/llvm-link/llvm-link.cpp b/llvm/tools/llvm-link/llvm-link.cpp
index f7dad3da5f6..f487d2452df 100644
--- a/llvm/tools/llvm-link/llvm-link.cpp
+++ b/llvm/tools/llvm-link/llvm-link.cpp
@@ -116,19 +116,13 @@ int main(int argc, char **argv) {
if (DumpAsm) errs() << "Here's the assembly:\n" << *Composite;
std::string ErrorInfo;
- std::auto_ptr<raw_ostream>
- Out(new raw_fd_ostream(OutputFilename.c_str(), ErrorInfo,
- raw_fd_ostream::F_Binary));
+ tool_output_file Out(OutputFilename.c_str(), ErrorInfo,
+ raw_fd_ostream::F_Binary);
if (!ErrorInfo.empty()) {
errs() << ErrorInfo << '\n';
return 1;
}
- // Make sure that the Out file gets unlinked from the disk if we get a
- // SIGINT
- if (OutputFilename != "-")
- sys::RemoveFileOnSignal(sys::Path(OutputFilename));
-
if (verifyModule(*Composite)) {
errs() << argv[0] << ": linked module is broken!\n";
return 1;
@@ -136,9 +130,12 @@ int main(int argc, char **argv) {
if (Verbose) errs() << "Writing bitcode...\n";
if (OutputAssembly) {
- *Out << *Composite;
- } else if (Force || !CheckBitcodeOutputToConsole(*Out, true))
- WriteBitcodeToFile(Composite.get(), *Out);
+ Out << *Composite;
+ } else if (Force || !CheckBitcodeOutputToConsole(Out, true))
+ WriteBitcodeToFile(Composite.get(), Out);
+
+ // Declare success.
+ Out.keep();
return 0;
}
OpenPOWER on IntegriCloud