summaryrefslogtreecommitdiff
path: root/tools/gccld
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-04-18 19:55:25 +0000
committerChris Lattner <sabre@nondot.org>2002-04-18 19:55:25 +0000
commit76d12299b5333d71bfc079614031f97c97aa5148 (patch)
tree184ef3d1792d7c134d5505b57b5525ccb688ade6 /tools/gccld
parentbac27a49b1eb47018169dcde469d84363465aa2c (diff)
downloadllvm-76d12299b5333d71bfc079614031f97c97aa5148.tar.gz
llvm-76d12299b5333d71bfc079614031f97c97aa5148.tar.bz2
llvm-76d12299b5333d71bfc079614031f97c97aa5148.tar.xz
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
Diffstat (limited to 'tools/gccld')
-rw-r--r--tools/gccld/gccld.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/gccld/gccld.cpp b/tools/gccld/gccld.cpp
index 11595f7d22..1e16aa1006 100644
--- a/tools/gccld/gccld.cpp
+++ b/tools/gccld/gccld.cpp
@@ -24,6 +24,7 @@
#include "llvm/Transforms/ConstantMerge.h"
#include "llvm/Transforms/IPO/GlobalDCE.h"
#include "Support/CommandLine.h"
+#include "Support/Signals.h"
#include <fstream>
#include <memory>
#include <algorithm>
@@ -161,6 +162,9 @@ int main(int argc, char **argv) {
}
Passes.add(new WriteBytecodePass(&Out)); // Write bytecode to file...
+ // Make sure that the Out file gets unlink'd from the disk if we get a SIGINT
+ RemoveFileOnSignal(OutputFilename+".bc");
+
// Run our queue of passes all at once now, efficiently.
Passes.run(Composite.get());
Out.close();