From 76d12299b5333d71bfc079614031f97c97aa5148 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 18 Apr 2002 19:55:25 +0000 Subject: Make sure that there is no case where a signal can occur leaving a partially written output file. This is important because crashing testcases often write part of a file out, and the testing harness decides the file is up-to-date next time the test is run. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2303 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-as/as.cpp | 4 ++++ tools/llvm-as/llvm-as.cpp | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'tools/llvm-as') diff --git a/tools/llvm-as/as.cpp b/tools/llvm-as/as.cpp index 7bea711826..3e8a9eaf31 100644 --- a/tools/llvm-as/as.cpp +++ b/tools/llvm-as/as.cpp @@ -13,6 +13,7 @@ #include "llvm/Assembly/Parser.h" #include "llvm/Bytecode/Writer.h" #include "Support/CommandLine.h" +#include "Support/Signals.h" #include #include #include @@ -70,6 +71,9 @@ int main(int argc, char **argv) { } Out = new std::ofstream(OutputFilename.c_str()); + // Make sure that the Out file gets unlink'd from the disk if we get a + // SIGINT + RemoveFileOnSignal(OutputFilename); } } diff --git a/tools/llvm-as/llvm-as.cpp b/tools/llvm-as/llvm-as.cpp index 7bea711826..3e8a9eaf31 100644 --- a/tools/llvm-as/llvm-as.cpp +++ b/tools/llvm-as/llvm-as.cpp @@ -13,6 +13,7 @@ #include "llvm/Assembly/Parser.h" #include "llvm/Bytecode/Writer.h" #include "Support/CommandLine.h" +#include "Support/Signals.h" #include #include #include @@ -70,6 +71,9 @@ int main(int argc, char **argv) { } Out = new std::ofstream(OutputFilename.c_str()); + // Make sure that the Out file gets unlink'd from the disk if we get a + // SIGINT + RemoveFileOnSignal(OutputFilename); } } -- cgit v1.2.3