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
diff --git a/tools/gccas/gccas.cpp b/tools/gccas/gccas.cpp
index 1bf1e8c..02d7cfe 100644
--- a/tools/gccas/gccas.cpp
+++ b/tools/gccas/gccas.cpp
@@ -20,6 +20,7 @@
 #include "llvm/Transforms/Scalar/PromoteMemoryToRegister.h"
 #include "llvm/Bytecode/WriteBytecodePass.h"
 #include "Support/CommandLine.h"
+#include "Support/Signals.h"
 #include <memory>
 #include <fstream>
 #include <string>
@@ -64,6 +65,9 @@
     return 1;
   }
 
+  // Make sure that the Out file gets unlink'd from the disk if we get a SIGINT
+  RemoveFileOnSignal(OutputFilename);
+
   // In addition to just parsing the input from GCC, we also want to spiff it up
   // a little bit.  Do this now.
   //