aboutsummaryrefslogtreecommitdiff
path: root/tools/llvm-extract/llvm-extract.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/llvm-extract/llvm-extract.cpp')
-rw-r--r--tools/llvm-extract/llvm-extract.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/tools/llvm-extract/llvm-extract.cpp b/tools/llvm-extract/llvm-extract.cpp
index 440d1bdcb5..190ab2e6b1 100644
--- a/tools/llvm-extract/llvm-extract.cpp
+++ b/tools/llvm-extract/llvm-extract.cpp
@@ -116,14 +116,9 @@ int main(int argc, char **argv) {
Passes.add(createDeadTypeEliminationPass()); // Remove dead types...
Passes.add(createStripDeadPrototypesPass()); // Remove dead func decls
- // Make sure that the Output file gets unlinked from the disk if we get a
- // SIGINT
- if (OutputFilename != "-")
- sys::RemoveFileOnSignal(sys::Path(OutputFilename));
-
std::string ErrorInfo;
- raw_fd_ostream Out(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;
@@ -136,5 +131,8 @@ int main(int argc, char **argv) {
Passes.run(*M.get());
+ // Declare success.
+ Out.keep();
+
return 0;
}