[PATCH] D112250: Support: Reduce stats in fs::copy_file on Darwin

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 21 11:08:13 PDT 2021


dexonsmith created this revision.
dexonsmith added reviewers: JDevlieghere, aprantl.
Herald added a subscriber: hiraditya.
dexonsmith requested review of this revision.
Herald added a project: LLVM.

fs::copy_file() on Darwin has a nice optimization to clone the file when
possible. Change the implementation to use clonefile() directly, instead
of the higher-level copyfile().  The latter does the wrong thing for
symlinks, which requires calling `stat` first...

With that out of the way, optimistically call clonefile() all the time,
and then for any error that's recoverable try again with copyfile()
(without the COPYFILE_CLONE flag, as before).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112250

Files:
  llvm/lib/Support/Unix/Path.inc
  llvm/unittests/Support/Path.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112250.381333.patch
Type: text/x-patch
Size: 5113 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211021/12b27792/attachment.bin>


More information about the llvm-commits mailing list