From b7e2188f7fb9a1c1cb6dbd32b206e44b11b4a157 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 13 Jun 2013 21:16:58 +0000 Subject: Don't use PathV1.h in Signals.h. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183947 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/ToolOutputFile.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/Support/ToolOutputFile.cpp') diff --git a/lib/Support/ToolOutputFile.cpp b/lib/Support/ToolOutputFile.cpp index e7ca927..f58d070 100644 --- a/lib/Support/ToolOutputFile.cpp +++ b/lib/Support/ToolOutputFile.cpp @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/ToolOutputFile.h" +#include "llvm/Support/PathV1.h" #include "llvm/Support/Signals.h" using namespace llvm; @@ -19,7 +20,7 @@ tool_output_file::CleanupInstaller::CleanupInstaller(const char *filename) : Filename(filename), Keep(false) { // Arrange for the file to be deleted if the process is killed. if (Filename != "-") - sys::RemoveFileOnSignal(sys::Path(Filename)); + sys::RemoveFileOnSignal(Filename); } tool_output_file::CleanupInstaller::~CleanupInstaller() { @@ -30,7 +31,7 @@ tool_output_file::CleanupInstaller::~CleanupInstaller() { // Ok, the file is successfully written and closed, or deleted. There's no // further need to clean it up on signals. if (Filename != "-") - sys::DontRemoveFileOnSignal(sys::Path(Filename)); + sys::DontRemoveFileOnSignal(Filename); } tool_output_file::tool_output_file(const char *filename, std::string &ErrorInfo, -- cgit v1.1 From bb40b3e957b29d9147198aecdbc6c58d1486a610 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 14 Jun 2013 16:20:18 +0000 Subject: Remove a use of PathV1.h. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183985 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/ToolOutputFile.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/Support/ToolOutputFile.cpp') diff --git a/lib/Support/ToolOutputFile.cpp b/lib/Support/ToolOutputFile.cpp index f58d070..09fb6ee 100644 --- a/lib/Support/ToolOutputFile.cpp +++ b/lib/Support/ToolOutputFile.cpp @@ -12,7 +12,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/ToolOutputFile.h" -#include "llvm/Support/PathV1.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/Signals.h" using namespace llvm; @@ -25,8 +25,10 @@ tool_output_file::CleanupInstaller::CleanupInstaller(const char *filename) tool_output_file::CleanupInstaller::~CleanupInstaller() { // Delete the file if the client hasn't told us not to. - if (!Keep && Filename != "-") - sys::Path(Filename).eraseFromDisk(); + if (!Keep && Filename != "-") { + bool Existed; + sys::fs::remove(Filename, Existed); + } // Ok, the file is successfully written and closed, or deleted. There's no // further need to clean it up on signals. -- cgit v1.1 From 68c0efac35021516bf46b2793e56e0d9d804c9e8 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Mon, 17 Jun 2013 18:05:35 +0000 Subject: Don't use PathV1.h in LTOCodeGenerator.cpp This patch also adds a simpler version of sys::fs::remove and a tool_output_file constructor for when we already have an open file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184095 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/ToolOutputFile.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/Support/ToolOutputFile.cpp') diff --git a/lib/Support/ToolOutputFile.cpp b/lib/Support/ToolOutputFile.cpp index 09fb6ee..824e0a7 100644 --- a/lib/Support/ToolOutputFile.cpp +++ b/lib/Support/ToolOutputFile.cpp @@ -44,3 +44,7 @@ tool_output_file::tool_output_file(const char *filename, std::string &ErrorInfo, if (!ErrorInfo.empty()) Installer.Keep = true; } + +tool_output_file::tool_output_file(const char *Filename, int FD) + : Installer(Filename), OS(FD, true) { +} -- cgit v1.1 From 338d8592b0bd80a58e462caa2fa9a6a69dd2500e Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Mon, 17 Jun 2013 19:54:17 +0000 Subject: Revert "Remove a use of PathV1.h." This reverts commit r183985. We were missing the checks for not deleting things like /dev/null. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184111 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/ToolOutputFile.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'lib/Support/ToolOutputFile.cpp') diff --git a/lib/Support/ToolOutputFile.cpp b/lib/Support/ToolOutputFile.cpp index 824e0a7..af44b43 100644 --- a/lib/Support/ToolOutputFile.cpp +++ b/lib/Support/ToolOutputFile.cpp @@ -12,7 +12,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/ToolOutputFile.h" -#include "llvm/Support/FileSystem.h" +#include "llvm/Support/PathV1.h" #include "llvm/Support/Signals.h" using namespace llvm; @@ -25,10 +25,8 @@ tool_output_file::CleanupInstaller::CleanupInstaller(const char *filename) tool_output_file::CleanupInstaller::~CleanupInstaller() { // Delete the file if the client hasn't told us not to. - if (!Keep && Filename != "-") { - bool Existed; - sys::fs::remove(Filename, Existed); - } + if (!Keep && Filename != "-") + sys::Path(Filename).eraseFromDisk(); // Ok, the file is successfully written and closed, or deleted. There's no // further need to clean it up on signals. -- cgit v1.1 From 99ccd5d5ef01881b3464b6e6a5b13b9d2c77387e Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Mon, 17 Jun 2013 20:37:56 +0000 Subject: Reapply r183985 now that the missing check was added to PathV2. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184120 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/ToolOutputFile.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/Support/ToolOutputFile.cpp') diff --git a/lib/Support/ToolOutputFile.cpp b/lib/Support/ToolOutputFile.cpp index af44b43..824e0a7 100644 --- a/lib/Support/ToolOutputFile.cpp +++ b/lib/Support/ToolOutputFile.cpp @@ -12,7 +12,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/ToolOutputFile.h" -#include "llvm/Support/PathV1.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/Signals.h" using namespace llvm; @@ -25,8 +25,10 @@ tool_output_file::CleanupInstaller::CleanupInstaller(const char *filename) tool_output_file::CleanupInstaller::~CleanupInstaller() { // Delete the file if the client hasn't told us not to. - if (!Keep && Filename != "-") - sys::Path(Filename).eraseFromDisk(); + if (!Keep && Filename != "-") { + bool Existed; + sys::fs::remove(Filename, Existed); + } // Ok, the file is successfully written and closed, or deleted. There's no // further need to clean it up on signals. -- cgit v1.1 From c1b49b56d4132efa2e06deb8f23508d0de4c8800 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 16 Jul 2013 19:44:17 +0000 Subject: Add a wrapper for open. This centralizes the handling of O_BINARY and opens the way for hiding more differences (like how open behaves with directories). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186447 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/ToolOutputFile.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/Support/ToolOutputFile.cpp') diff --git a/lib/Support/ToolOutputFile.cpp b/lib/Support/ToolOutputFile.cpp index 824e0a7..5c1268a 100644 --- a/lib/Support/ToolOutputFile.cpp +++ b/lib/Support/ToolOutputFile.cpp @@ -37,9 +37,8 @@ tool_output_file::CleanupInstaller::~CleanupInstaller() { } tool_output_file::tool_output_file(const char *filename, std::string &ErrorInfo, - unsigned Flags) - : Installer(filename), - OS(filename, ErrorInfo, Flags) { + sys::fs::OpenFlags Flags) + : Installer(filename), OS(filename, ErrorInfo, Flags) { // If open fails, no cleanup is needed. if (!ErrorInfo.empty()) Installer.Keep = true; -- cgit v1.1