mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
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
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include "llvm/Bytecode/Writer.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "Support/CommandLine.h"
|
||||
#include "Support/Signals.h"
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <sys/types.h> // For FileExists
|
||||
@@ -126,6 +127,10 @@ int main(int argc, char **argv) {
|
||||
cerr << "Error opening '" << OutputFilename << "'!\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Make sure that the Out file gets unlink'd from the disk if we get a
|
||||
// SIGINT
|
||||
RemoveFileOnSignal(OutputFilename);
|
||||
}
|
||||
|
||||
if (Verbose) cerr << "Writing bytecode...\n";
|
||||
|
Reference in New Issue
Block a user