summaryrefslogtreecommitdiff
path: root/lib/Support
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-06-12 14:16:52 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-06-12 14:16:52 +0000
commit36782c514ae7c5f9270c317bdea660bdcd86d9d6 (patch)
tree553fd31405ad4ba1c1545f463081dc8461c5a1e4 /lib/Support
parenta5e855d8594ccc7e7fffd2c1886088175ba84950 (diff)
downloadllvm-36782c514ae7c5f9270c317bdea660bdcd86d9d6.tar.gz
llvm-36782c514ae7c5f9270c317bdea660bdcd86d9d6.tar.bz2
llvm-36782c514ae7c5f9270c317bdea660bdcd86d9d6.tar.xz
Remove sys::CopyFile.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183831 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
-rw-r--r--lib/Support/Unix/Path.inc47
-rw-r--r--lib/Support/Windows/Path.inc11
2 files changed, 0 insertions, 58 deletions
diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc
index 7b236a56e1..b17b9f91de 100644
--- a/lib/Support/Unix/Path.inc
+++ b/lib/Support/Unix/Path.inc
@@ -667,53 +667,6 @@ Path::setStatusInfoOnDisk(const FileStatus &si, std::string *ErrStr) const {
}
bool
-sys::CopyFile(const sys::Path &Dest, const sys::Path &Src, std::string* ErrMsg){
- int inFile = -1;
- int outFile = -1;
- inFile = ::open(Src.c_str(), O_RDONLY);
- if (inFile == -1)
- return MakeErrMsg(ErrMsg, Src.str() +
- ": can't open source file to copy");
-
- outFile = ::open(Dest.c_str(), O_WRONLY|O_CREAT, 0666);
- if (outFile == -1) {
- ::close(inFile);
- return MakeErrMsg(ErrMsg, Dest.str() +
- ": can't create destination file for copy");
- }
-
- char Buffer[16*1024];
- while (ssize_t Amt = ::read(inFile, Buffer, 16*1024)) {
- if (Amt == -1) {
- if (errno != EINTR && errno != EAGAIN) {
- ::close(inFile);
- ::close(outFile);
- return MakeErrMsg(ErrMsg, Src.str()+": can't read source file");
- }
- } else {
- char *BufPtr = Buffer;
- while (Amt) {
- ssize_t AmtWritten = ::write(outFile, BufPtr, Amt);
- if (AmtWritten == -1) {
- if (errno != EINTR && errno != EAGAIN) {
- ::close(inFile);
- ::close(outFile);
- return MakeErrMsg(ErrMsg, Dest.str() +
- ": can't write destination file");
- }
- } else {
- Amt -= AmtWritten;
- BufPtr += AmtWritten;
- }
- }
- }
- }
- ::close(inFile);
- ::close(outFile);
- return false;
-}
-
-bool
Path::makeUnique(bool reuse_current, std::string* ErrMsg) {
bool Exists;
if (reuse_current && (fs::exists(path, Exists) || !Exists))
diff --git a/lib/Support/Windows/Path.inc b/lib/Support/Windows/Path.inc
index f4a2a1b447..734e6f50d8 100644
--- a/lib/Support/Windows/Path.inc
+++ b/lib/Support/Windows/Path.inc
@@ -21,7 +21,6 @@
#include <malloc.h>
// We need to undo a macro defined in Windows.h, otherwise we won't compile:
-#undef CopyFile
#undef GetCurrentDirectory
// Windows happily accepts either forward or backward slashes, though any path
@@ -731,16 +730,6 @@ Path::setStatusInfoOnDisk(const FileStatus &si, std::string *ErrMsg) const {
}
bool
-CopyFile(const sys::Path &Dest, const sys::Path &Src, std::string* ErrMsg) {
- // Can't use CopyFile macro defined in Windows.h because it would mess up the
- // above line. We use the expansion it would have in a non-UNICODE build.
- if (!::CopyFileA(Src.c_str(), Dest.c_str(), false))
- return MakeErrMsg(ErrMsg, "Can't copy '" + Src.str() +
- "' to '" + Dest.str() + "': ");
- return false;
-}
-
-bool
Path::makeUnique(bool reuse_current, std::string* ErrMsg) {
bool Exists;
if (reuse_current && (fs::exists(path, Exists) || !Exists))