From ff9cd968cd5b623e3ec7e5f862b598cd22f7ec79 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Mon, 31 Jan 2011 22:00:42 +0000 Subject: Frontend: Add an explicit RemoveFileOnSignal flag argument, to control the automatic behavior (which is undesirable in a multithreaded context). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124612 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Frontend/CompilerInstance.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib/Frontend/CompilerInstance.cpp') diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp index 901f8fa927..9ff2e9d1be 100644 --- a/lib/Frontend/CompilerInstance.cpp +++ b/lib/Frontend/CompilerInstance.cpp @@ -381,16 +381,17 @@ CompilerInstance::createDefaultOutputFile(bool Binary, llvm::StringRef InFile, llvm::StringRef Extension) { return createOutputFile(getFrontendOpts().OutputFile, Binary, - InFile, Extension); + /*RemoveFileOnSignal=*/true, InFile, Extension); } llvm::raw_fd_ostream * CompilerInstance::createOutputFile(llvm::StringRef OutputPath, - bool Binary, + bool Binary, bool RemoveFileOnSignal, llvm::StringRef InFile, llvm::StringRef Extension) { std::string Error, OutputPathName, TempPathName; llvm::raw_fd_ostream *OS = createOutputFile(OutputPath, Error, Binary, + RemoveFileOnSignal, InFile, Extension, &OutputPathName, &TempPathName); @@ -412,6 +413,7 @@ llvm::raw_fd_ostream * CompilerInstance::createOutputFile(llvm::StringRef OutputPath, std::string &Error, bool Binary, + bool RemoveFileOnSignal, llvm::StringRef InFile, llvm::StringRef Extension, std::string *ResultPathName, @@ -455,7 +457,8 @@ CompilerInstance::createOutputFile(llvm::StringRef OutputPath, return 0; // Make sure the out stream file gets removed if we crash. - llvm::sys::RemoveFileOnSignal(llvm::sys::Path(OSFile)); + if (RemoveFileOnSignal) + llvm::sys::RemoveFileOnSignal(llvm::sys::Path(OSFile)); if (ResultPathName) *ResultPathName = OutFile; -- cgit v1.2.3