From cf34a554b5fb5d3909d82bcf8d540d7c0cd434f9 Mon Sep 17 00:00:00 2001
From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Date: Wed, 27 Dec 2017 23:05:43 -0800
Subject: [PATCH] Threading: Only call pthread_setname_np() on SnowLeopard+

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
---
 llvm/lib/Support/Unix/Threading.inc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/llvm/lib/Support/Unix/Threading.inc b/llvm/lib/Support/Unix/Threading.inc
index 2d0aacabf092..78ef46cd1a4c 100644
--- a/llvm/lib/Support/Unix/Threading.inc
+++ b/llvm/lib/Support/Unix/Threading.inc
@@ -175,8 +175,10 @@ void llvm::set_thread_name(const Twine &Name) {
   ::pthread_setname_np(::pthread_self(), "%s",
     const_cast<char *>(NameStr.data()));
 #elif defined(__APPLE__)
+#if HAVE_PTHREAD_SETNAME_NP
   ::pthread_setname_np(NameStr.data());
 #endif
+#endif
 }
 
 void llvm::get_thread_name(SmallVectorImpl<char> &Name) {
-- 
2.37.2

