[all-commits] [llvm/llvm-project] 0d5b64: Support: Reduce stats in fs::copy_file on Darwin

Duncan P. N. Exon Smith via All-commits all-commits at lists.llvm.org
Fri Oct 29 16:48:50 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0d5b6423bac61efd8aaedaa7b65b462d2f08c661
      https://github.com/llvm/llvm-project/commit/0d5b6423bac61efd8aaedaa7b65b462d2f08c661
  Author: Duncan P. N. Exon Smith <dexonsmith at apple.com>
  Date:   2021-10-29 (Fri, 29 Oct 2021)

  Changed paths:
    M llvm/lib/Support/Unix/Path.inc
    M llvm/unittests/Support/Path.cpp

  Log Message:
  -----------
  Support: Reduce stats in fs::copy_file on Darwin

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).

Differential Revision: https://reviews.llvm.org/D112250




More information about the All-commits mailing list