[PATCH] D131063: [llvm][macos] Fix usage of std::shared_mutex on old macOS SDK versions

Tobias Hieta via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 3 03:07:34 PDT 2022


thieta created this revision.
thieta added reviewers: thakis, nikic.
Herald added a project: All.
thieta requested review of this revision.
Herald added a project: LLVM.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131063

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


Index: llvm/include/llvm/Support/RWMutex.h
===================================================================
--- llvm/include/llvm/Support/RWMutex.h
+++ llvm/include/llvm/Support/RWMutex.h
@@ -94,14 +94,14 @@
 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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131063.449618.patch
Type: text/x-patch
Size: 724 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220803/39d03e81/attachment.bin>


More information about the llvm-commits mailing list