mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-14 23:48:56 +00:00
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
This commit is contained in:
parent
10ce496201
commit
a2f7ed7035
@ -15,7 +15,7 @@
|
|||||||
#ifndef LLVM_SUPPORT_FILEUTILITIES_H
|
#ifndef LLVM_SUPPORT_FILEUTILITIES_H
|
||||||
#define LLVM_SUPPORT_FILEUTILITIES_H
|
#define LLVM_SUPPORT_FILEUTILITIES_H
|
||||||
|
|
||||||
#include <string>
|
#include "llvm/System/Path.h"
|
||||||
|
|
||||||
namespace llvm {
|
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);
|
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
|
/// FDHandle - Simple handle class to make sure a file descriptor gets closed
|
||||||
/// when the object is destroyed. This handle acts similarly to an
|
/// when the object is destroyed. This handle acts similarly to an
|
||||||
/// std::auto_ptr, in that the copy constructor and assignment operators
|
/// std::auto_ptr, in that the copy constructor and assignment operators
|
||||||
@ -81,14 +77,15 @@ public:
|
|||||||
/// specified (if deleteIt is true).
|
/// specified (if deleteIt is true).
|
||||||
///
|
///
|
||||||
class FileRemover {
|
class FileRemover {
|
||||||
std::string Filename;
|
sys::Path Filename;
|
||||||
bool DeleteIt;
|
bool DeleteIt;
|
||||||
public:
|
public:
|
||||||
FileRemover(const std::string &filename, bool deleteIt = true)
|
FileRemover(const sys::Path &filename, bool deleteIt = true)
|
||||||
: Filename(filename), DeleteIt(deleteIt) {}
|
: Filename(filename), DeleteIt(deleteIt) {}
|
||||||
|
|
||||||
~FileRemover() {
|
~FileRemover() {
|
||||||
if (DeleteIt) removeFile(Filename);
|
if (DeleteIt)
|
||||||
|
Filename.destroyFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// releaseFile - Take ownership of the file away from the FileRemover so it
|
/// releaseFile - Take ownership of the file away from the FileRemover so it
|
||||||
|
@ -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
|
// FDHandle class implementation
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user