[llvm] 4b8db17 - [llvm][macos] Fix usage of std::shared_mutex on old macOS SDK versions

Tobias Hieta via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 5 12:45:28 PDT 2022


Author: Tobias Hieta
Date: 2022-08-05T21:45:23+02:00
New Revision: 4b8db17c32e04a1fe17440a6fb80aa96f31ff068

URL: https://github.com/llvm/llvm-project/commit/4b8db17c32e04a1fe17440a6fb80aa96f31ff068
DIFF: https://github.com/llvm/llvm-project/commit/4b8db17c32e04a1fe17440a6fb80aa96f31ff068.diff

LOG: [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

Added: 
    

Modified: 
    llvm/include/llvm/Support/RWMutex.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/RWMutex.h b/llvm/include/llvm/Support/RWMutex.h
index 3dd962586c366..a06a5c3e064fb 100644
--- a/llvm/include/llvm/Support/RWMutex.h
+++ b/llvm/include/llvm/Support/RWMutex.h
@@ -94,14 +94,14 @@ class RWMutexImpl {
 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;


        


More information about the llvm-commits mailing list