Guard __builtin_available() with __has_builtin to support older host compilers.
llvm-svn: 360174
diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc
index fa5115b..fb14422 100644
--- a/llvm/lib/Support/Unix/Path.inc
+++ b/llvm/lib/Support/Unix/Path.inc
@@ -1137,6 +1137,7 @@
/// 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 @@
if (!IsSymlink && !exists(To))
Flag = COPYFILE_CLONE;
}
-
+#endif
int Status =
copyfile(From.str().c_str(), To.str().c_str(), /* State */ NULL, Flag);