[llvm] r369154 - [RWMutex] Simplify availability check
Jonas Devlieghere via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 16 14:25:40 PDT 2019
Author: jdevlieghere
Date: Fri Aug 16 14:25:40 2019
New Revision: 369154
URL: http://llvm.org/viewvc/llvm-project?rev=369154&view=rev
Log:
[RWMutex] Simplify availability check
Check for the actual version number for the scenarios where the macOS
version isn't available (__MAC_10_12).
Modified:
llvm/trunk/include/llvm/Support/RWMutex.h
llvm/trunk/lib/Support/RWMutex.cpp
Modified: llvm/trunk/include/llvm/Support/RWMutex.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/RWMutex.h?rev=369154&r1=369153&r2=369154&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/RWMutex.h (original)
+++ llvm/trunk/include/llvm/Support/RWMutex.h Fri Aug 16 14:25:40 2019
@@ -20,16 +20,16 @@
#include <shared_mutex>
// std::shared_timed_mutex is only availble on macOS 10.12 and later.
-#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
- defined(__MAC_10_12) && \
- __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < __MAC_10_12
-#define USE_RW_MUTEX_IMPL
+#if defined(__APPLE__) && defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
+#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200
+#define LLVM_USE_RW_MUTEX_IMPL
+#endif
#endif
namespace llvm {
namespace sys {
-#if defined(USE_RW_MUTEX_IMPL)
+#if defined(LLVM_USE_RW_MUTEX_IMPL)
/// Platform agnostic RWMutex class.
class RWMutexImpl {
/// @name Constructors
@@ -97,7 +97,7 @@ template <bool mt_only> class SmartRWMut
#if defined(_MSC_VER) || __cplusplus > 201402L
std::shared_mutex impl;
#else
-#if !defined(USE_RW_MUTEX_IMPL)
+#if !defined(LLVM_USE_RW_MUTEX_IMPL)
std::shared_timed_mutex impl;
#else
RWMutexImpl impl;
@@ -162,7 +162,7 @@ public:
typedef SmartRWMutex<false> RWMutex;
/// ScopedReader - RAII acquisition of a reader lock
-#if !defined(USE_RW_MUTEX_IMPL)
+#if !defined(LLVM_USE_RW_MUTEX_IMPL)
template <bool mt_only>
using SmartScopedReader = const std::shared_lock<SmartRWMutex<mt_only>>;
#else
@@ -179,7 +179,7 @@ template <bool mt_only> struct SmartScop
typedef SmartScopedReader<false> ScopedReader;
/// ScopedWriter - RAII acquisition of a writer lock
-#if !defined(USE_RW_MUTEX_IMPL)
+#if !defined(LLVM_USE_RW_MUTEX_IMPL)
template <bool mt_only>
using SmartScopedWriter = std::lock_guard<SmartRWMutex<mt_only>>;
#else
Modified: llvm/trunk/lib/Support/RWMutex.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/RWMutex.cpp?rev=369154&r1=369153&r2=369154&view=diff
==============================================================================
--- llvm/trunk/lib/Support/RWMutex.cpp (original)
+++ llvm/trunk/lib/Support/RWMutex.cpp Fri Aug 16 14:25:40 2019
@@ -14,7 +14,7 @@
#include "llvm/Support/RWMutex.h"
#include "llvm/Config/config.h"
-#if defined(USE_RW_MUTEX_IMPL)
+#if defined(LLVM_USE_RW_MUTEX_IMPL)
using namespace llvm;
using namespace sys;
More information about the llvm-commits
mailing list