[llvm][macos] Fix usage of std::shared_mutex on old macOS SDK versions
When setting CMAKE_CXX_STANDARD to 17 and targeting a macOS version
under 10.12 the ifdefs would try to use std::shared_mutex because
the of the C++ standard. This should also check the targeted SDK.
See discussion in: https://reviews.llvm.org/D130689
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D131063
GitOrigin-RevId: 4b8db17c32e04a1fe17440a6fb80aa96f31ff068
diff --git a/include/llvm/Support/RWMutex.h b/include/llvm/Support/RWMutex.h
index 3dd9625..a06a5c3 100644
--- a/include/llvm/Support/RWMutex.h
+++ b/include/llvm/Support/RWMutex.h
@@ -94,15 +94,15 @@
template <bool mt_only> class SmartRWMutex {
// shared_mutex (C++17) is more efficient than shared_timed_mutex (C++14)
// on Windows and always available on MSVC except with libc++.
+#if !defined(LLVM_USE_RW_MUTEX_IMPL)
#if (defined(_MSC_VER) && !defined(_LIBCPP_VERSION)) || __cplusplus > 201402L
std::shared_mutex impl;
#else
-#if !defined(LLVM_USE_RW_MUTEX_IMPL)
std::shared_timed_mutex impl;
+#endif
#else
RWMutexImpl impl;
#endif
-#endif
unsigned readers = 0;
unsigned writers = 0;