diff options
author | Chris Lattner <sabre@nondot.org> | 2010-03-27 18:01:10 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-03-27 18:01:10 +0000 |
commit | 46475cb08e5ac0bb66d23a134e95abcc95dc9ddf (patch) | |
tree | e4ef41eae55219984cb6d3ff80f99ac197743e4a /tools | |
parent | 00ad2785002098bf4c1bd052d67c33eada9d6fc6 (diff) | |
download | external_llvm-46475cb08e5ac0bb66d23a134e95abcc95dc9ddf.zip external_llvm-46475cb08e5ac0bb66d23a134e95abcc95dc9ddf.tar.gz external_llvm-46475cb08e5ac0bb66d23a134e95abcc95dc9ddf.tar.bz2 |
revert r99719 which is breaking the botz.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99721 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/llvm-ld/llvm-ld.cpp | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/tools/llvm-ld/llvm-ld.cpp b/tools/llvm-ld/llvm-ld.cpp index 4749fea..9956e23 100644 --- a/tools/llvm-ld/llvm-ld.cpp +++ b/tools/llvm-ld/llvm-ld.cpp @@ -30,7 +30,6 @@ #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Support/CommandLine.h" -#include "llvm/Support/FileUtilities.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/PrettyStackTrace.h" @@ -125,10 +124,6 @@ static cl::opt<std::string> CO9("m", cl::Hidden, /// everywhere. static std::string progname; -/// FileRemover objects to clean up output files in the event of an error. -static FileRemover OutputRemover; -static FileRemover BitcodeOutputRemover; - /// PrintAndExit - Prints a message to standard error and exits with error code /// /// Inputs: @@ -241,6 +236,10 @@ void GenerateBitcode(Module* M, const std::string& FileName) { if (!ErrorInfo.empty()) PrintAndExit(ErrorInfo, M); + // Ensure that the bitcode file gets removed from the disk if we get a + // terminating signal. + sys::RemoveFileOnSignal(sys::Path(FileName)); + // Write it out WriteBitcodeToFile(M, Out); } @@ -583,17 +582,8 @@ int main(int argc, char **argv, char **envp) { if (!LinkAsLibrary) BitcodeOutputFilename += ".bc"; } - // Arrange for the bitcode output file to be deleted on any errors. - BitcodeOutputRemover = FileRemover(sys::Path(BitcodeOutputFilename)); - sys::RemoveFileOnSignal(sys::Path(BitcodeOutputFilename)); - - // Generate the bitcode output. GenerateBitcode(Composite.get(), BitcodeOutputFilename); - // Arrange for the output file to be deleted on any errors. - OutputRemover = FileRemover(sys::Path(OutputFilename)); - sys::RemoveFileOnSignal(sys::Path(OutputFilename)); - // If we are not linking a library, generate either a native executable // or a JIT shell script, depending upon what the user wants. if (!LinkAsLibrary) { @@ -646,6 +636,7 @@ int main(int argc, char **argv, char **envp) { // Mark the output files for removal if we get an interrupt. sys::RemoveFileOnSignal(AssemblyFile); + sys::RemoveFileOnSignal(sys::Path(OutputFilename)); // Determine the locations of the llc and gcc programs. sys::Path llc = FindExecutable("llc", argv[0], @@ -675,6 +666,7 @@ int main(int argc, char **argv, char **envp) { // Mark the output files for removal if we get an interrupt. sys::RemoveFileOnSignal(CFile); + sys::RemoveFileOnSignal(sys::Path(OutputFilename)); // Determine the locations of the llc and gcc programs. sys::Path llc = FindExecutable("llc", argv[0], @@ -715,10 +707,6 @@ int main(int argc, char **argv, char **envp) { PrintAndExit(ErrMsg, Composite.get()); } - // Operations which may fail are now complete. - OutputRemover.releaseFile(); - BitcodeOutputRemover.releaseFile(); - // Graceful exit return 0; } |