ToolOutputFile.cpp [plain text]
#include "llvm/Support/ToolOutputFile.h"
#include "llvm/Support/Signals.h"
using namespace llvm;
tool_output_file::CleanupInstaller::CleanupInstaller(const char *filename)
: Filename(filename), Keep(false) {
if (Filename != "-")
sys::RemoveFileOnSignal(sys::Path(Filename));
}
tool_output_file::CleanupInstaller::~CleanupInstaller() {
if (!Keep && Filename != "-")
sys::Path(Filename).eraseFromDisk();
if (Filename != "-")
sys::DontRemoveFileOnSignal(sys::Path(Filename));
}
tool_output_file::tool_output_file(const char *filename, std::string &ErrorInfo,
unsigned Flags)
: Installer(filename),
OS(filename, ErrorInfo, Flags) {
if (!ErrorInfo.empty())
Installer.Keep = true;
}