summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Path.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2019-04-18 21:22:50 +0000
committerAdrian Prantl <aprantl@apple.com>2019-04-18 21:22:50 +0000
commitfac7875704b46f77e5a8b2871216e01b9b357401 (patch)
tree498fdfd8ba26029293f7ed1143d023fbcb14fbed /llvm/lib/Support/Path.cpp
parent0aa9b453c40ec4707ebb9b7a7e2bd21919d5e470 (diff)
downloadbcm5719-llvm-fac7875704b46f77e5a8b2871216e01b9b357401.tar.gz
bcm5719-llvm-fac7875704b46f77e5a8b2871216e01b9b357401.zip
Implement sys::fs::copy_file using the macOS copyfile(3) API
to support APFS clones. This patch adds a Darwin-specific implementation of llvm::sys::fs::copy_file() that uses the macOS copyfile(3) API to support APFS copy-on-write clones, which should be faster and much more space efficient. https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/APFS_Guide/ToolsandAPIs/ToolsandAPIs.html Differential Revision: https://reviews.llvm.org/D60802 This reapplies 358628 with an additional bugfix handling the case where the destination file already exists. (Caught by the clang testsuite). llvm-svn: 358716
Diffstat (limited to 'llvm/lib/Support/Path.cpp')
-rw-r--r--llvm/lib/Support/Path.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Support/Path.cpp b/llvm/lib/Support/Path.cpp
index 902df74a68f..9466591c25e 100644
--- a/llvm/lib/Support/Path.cpp
+++ b/llvm/lib/Support/Path.cpp
@@ -935,6 +935,7 @@ std::error_code create_directories(const Twine &Path, bool IgnoreExisting,
return create_directory(P, IgnoreExisting, Perms);
}
+#ifndef __APPLE__
static std::error_code copy_file_internal(int ReadFD, int WriteFD) {
const size_t BufSize = 4096;
char *Buf = new char[BufSize];
@@ -988,6 +989,7 @@ std::error_code copy_file(const Twine &From, int ToFD) {
return EC;
}
+#endif
ErrorOr<MD5::MD5Result> md5_contents(int FD) {
MD5 Hash;
OpenPOWER on IntegriCloud