summaryrefslogtreecommitdiffstats
path: root/llvm/tools/opt/opt.cpp
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
commitc065ad850cd17ce17c83453ccb96d5dc32d84494 (patch)
tree20536119ff49ee0c3ba515edb436270b19f9f14b /llvm/tools/opt/opt.cpp
parent1c2329ade33de1693492f97a1e4e26df6d2d78cc (diff)
downloadbcm5719-llvm-c065ad850cd17ce17c83453ccb96d5dc32d84494.tar.gz
bcm5719-llvm-c065ad850cd17ce17c83453ccb96d5dc32d84494.zip
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. llvm-svn: 2303
Diffstat (limited to 'llvm/tools/opt/opt.cpp')
-rw-r--r--llvm/tools/opt/opt.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp
index f922dd82ccb..f08567a6b89 100644
--- a/llvm/tools/opt/opt.cpp
+++ b/llvm/tools/opt/opt.cpp
@@ -31,6 +31,7 @@
#include "llvm/Transforms/Instrumentation/TraceValues.h"
#include "llvm/Transforms/Instrumentation/ProfilePaths.h"
#include "Support/CommandLine.h"
+#include "Support/Signals.h"
#include <fstream>
#include <memory>
@@ -174,6 +175,10 @@ int main(int argc, char **argv) {
cerr << "Error opening " << OutputFilename << "!\n";
return 1;
}
+
+ // Make sure that the Output file gets unlink'd from the disk if we get a
+ // SIGINT
+ RemoveFileOnSignal(OutputFilename);
}
// Create a PassManager to hold and optimize the collection of passes we are
OpenPOWER on IntegriCloud