aboutsummaryrefslogtreecommitdiffstats
path: root/lib/System
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-09-28 23:58:03 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-09-28 23:58:03 +0000
commitced4110f5b068b9b64e3a55a9ee57b621ce4acb1 (patch)
treefb2f1902bed8e5b7af4e8616c55c7b6e77b3fac0 /lib/System
parent10366a4ad9a8954ffb5934a4c94266291231277f (diff)
downloadexternal_llvm-ced4110f5b068b9b64e3a55a9ee57b621ce4acb1.zip
external_llvm-ced4110f5b068b9b64e3a55a9ee57b621ce4acb1.tar.gz
external_llvm-ced4110f5b068b9b64e3a55a9ee57b621ce4acb1.tar.bz2
Use llvm::sys::Path to destroy the file.
Patch contributed by Jeff Cohen. Thanks Jeff! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16564 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System')
-rw-r--r--lib/System/Win32/Signals.cpp9
-rw-r--r--lib/System/Win32/Signals.inc9
2 files changed, 10 insertions, 8 deletions
diff --git a/lib/System/Win32/Signals.cpp b/lib/System/Win32/Signals.cpp
index 692a047..908ae84 100644
--- a/lib/System/Win32/Signals.cpp
+++ b/lib/System/Win32/Signals.cpp
@@ -13,6 +13,7 @@
#include "Win32.h"
#include <llvm/System/Signals.h>
+#include <stdio.h>
#include <vector>
#ifdef __MINGW_H
@@ -29,7 +30,7 @@
static LONG WINAPI LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep);
static BOOL WINAPI LLVMConsoleCtrlHandler(DWORD dwCtrlType);
-static std::vector<std::string> *FilesToRemove = NULL;
+static std::vector<llvm::sys::Path> *FilesToRemove = NULL;
static std::vector<llvm::sys::Path> *DirectoriesToRemove = NULL;
static bool RegisteredUnhandledExceptionFilter = false;
static bool CleanupExecuted = false;
@@ -78,9 +79,9 @@ void sys::RemoveFileOnSignal(const std::string &Filename) {
throw std::string("Process terminating -- cannot register for removal");
if (FilesToRemove == NULL)
- FilesToRemove = new std::vector<std::string>;
+ FilesToRemove = new std::vector<sys::Path>;
- FilesToRemove->push_back(Filename);
+ FilesToRemove->push_back(sys::Path(Filename));
LeaveCriticalSection(&CriticalSection);
}
@@ -123,7 +124,7 @@ static void Cleanup() {
if (FilesToRemove != NULL)
while (!FilesToRemove->empty()) {
try {
- std::remove(FilesToRemove->back().c_str());
+ FilesToRemove->back().destroy_file();
} catch (...) {
}
FilesToRemove->pop_back();
diff --git a/lib/System/Win32/Signals.inc b/lib/System/Win32/Signals.inc
index 692a047..908ae84 100644
--- a/lib/System/Win32/Signals.inc
+++ b/lib/System/Win32/Signals.inc
@@ -13,6 +13,7 @@
#include "Win32.h"
#include <llvm/System/Signals.h>
+#include <stdio.h>
#include <vector>
#ifdef __MINGW_H
@@ -29,7 +30,7 @@
static LONG WINAPI LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep);
static BOOL WINAPI LLVMConsoleCtrlHandler(DWORD dwCtrlType);
-static std::vector<std::string> *FilesToRemove = NULL;
+static std::vector<llvm::sys::Path> *FilesToRemove = NULL;
static std::vector<llvm::sys::Path> *DirectoriesToRemove = NULL;
static bool RegisteredUnhandledExceptionFilter = false;
static bool CleanupExecuted = false;
@@ -78,9 +79,9 @@ void sys::RemoveFileOnSignal(const std::string &Filename) {
throw std::string("Process terminating -- cannot register for removal");
if (FilesToRemove == NULL)
- FilesToRemove = new std::vector<std::string>;
+ FilesToRemove = new std::vector<sys::Path>;
- FilesToRemove->push_back(Filename);
+ FilesToRemove->push_back(sys::Path(Filename));
LeaveCriticalSection(&CriticalSection);
}
@@ -123,7 +124,7 @@ static void Cleanup() {
if (FilesToRemove != NULL)
while (!FilesToRemove->empty()) {
try {
- std::remove(FilesToRemove->back().c_str());
+ FilesToRemove->back().destroy_file();
} catch (...) {
}
FilesToRemove->pop_back();