summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-12-16 23:00:05 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-12-16 23:00:05 +0000
commita2f7ed7035b38a13c65c04fa3b626197bd9d360a (patch)
tree7a51cf798926cc56db20b1837358d7bea4fe6618
parent10ce4962012e7085ca8847581f9445587682b718 (diff)
downloadllvm-a2f7ed7035b38a13c65c04fa3b626197bd9d360a.tar.gz
llvm-a2f7ed7035b38a13c65c04fa3b626197bd9d360a.tar.bz2
llvm-a2f7ed7035b38a13c65c04fa3b626197bd9d360a.tar.xz
For PR351:
* Remove the "removeFile" function, now implemented by the sys::Path::destroyFile method. * Make the FileRemove work with a sys::Path instead of a std::string git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18999 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Support/FileUtilities.h13
-rw-r--r--lib/Support/FileUtilities.cpp7
2 files changed, 5 insertions, 15 deletions
diff --git a/include/llvm/Support/FileUtilities.h b/include/llvm/Support/FileUtilities.h
index c594ac9899..6459cc9ad7 100644
--- a/include/llvm/Support/FileUtilities.h
+++ b/include/llvm/Support/FileUtilities.h
@@ -15,7 +15,7 @@
#ifndef LLVM_SUPPORT_FILEUTILITIES_H
#define LLVM_SUPPORT_FILEUTILITIES_H
-#include <string>
+#include "llvm/System/Path.h"
namespace llvm {
@@ -34,10 +34,6 @@ bool DiffFiles(const std::string &FileA, const std::string &FileB,
///
void MoveFileOverIfUpdated(const std::string &New, const std::string &Old);
-/// removeFile - Delete the specified file.
-///
-void removeFile(const std::string &Filename);
-
/// FDHandle - Simple handle class to make sure a file descriptor gets closed
/// when the object is destroyed. This handle acts similarly to an
/// std::auto_ptr, in that the copy constructor and assignment operators
@@ -81,14 +77,15 @@ public:
/// specified (if deleteIt is true).
///
class FileRemover {
- std::string Filename;
+ sys::Path Filename;
bool DeleteIt;
public:
- FileRemover(const std::string &filename, bool deleteIt = true)
+ FileRemover(const sys::Path &filename, bool deleteIt = true)
: Filename(filename), DeleteIt(deleteIt) {}
~FileRemover() {
- if (DeleteIt) removeFile(Filename);
+ if (DeleteIt)
+ Filename.destroyFile();
}
/// releaseFile - Take ownership of the file away from the FileRemover so it
diff --git a/lib/Support/FileUtilities.cpp b/lib/Support/FileUtilities.cpp
index b1924662e4..8f4917bae9 100644
--- a/lib/Support/FileUtilities.cpp
+++ b/lib/Support/FileUtilities.cpp
@@ -64,13 +64,6 @@ void llvm::MoveFileOverIfUpdated(const std::string &New,
}
}
-/// removeFile - Delete the specified file
-///
-void llvm::removeFile(const std::string &Filename) {
- std::remove(Filename.c_str());
-}
-
-
//===----------------------------------------------------------------------===//
// FDHandle class implementation
//