]> granicus.if.org Git - llvm/commitdiff
Guard __builtin_available() with __has_builtin to support older host compilers.
authorAdrian Prantl <aprantl@apple.com>
Tue, 7 May 2019 17:10:27 +0000 (17:10 +0000)
committerAdrian Prantl <aprantl@apple.com>
Tue, 7 May 2019 17:10:27 +0000 (17:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360174 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/Unix/Path.inc

index fa5115bfd6517b1bd8ada935d732d531394291bc..fb14422ba33af0c3542c8544a76fb89f27a4cbb2 100644 (file)
@@ -1137,6 +1137,7 @@ namespace fs {
 /// implementation.
 std::error_code copy_file(const Twine &From, const Twine &To) {
   uint32_t Flag = COPYFILE_DATA;
+#if __has_builtin(__builtin_available)
   if (__builtin_available(macos 10.12, *)) {
     bool IsSymlink;
     if (std::error_code Error = is_symlink_file(From, IsSymlink))
@@ -1146,7 +1147,7 @@ std::error_code copy_file(const Twine &From, const Twine &To) {
     if (!IsSymlink && !exists(To))
       Flag = COPYFILE_CLONE;
   }
-
+#endif
   int Status =
       copyfile(From.str().c_str(), To.str().c_str(), /* State */ NULL, Flag);