summaryrefslogtreecommitdiff
path: root/lib/Support/Mutex.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2018-07-28 10:51:19 +0000
committerDimitry Andric <dim@FreeBSD.org>2018-07-28 10:51:19 +0000
commiteb11fae6d08f479c0799db45860a98af528fa6e7 (patch)
tree44d492a50c8c1a7eb8e2d17ea3360ec4d066f042 /lib/Support/Mutex.cpp
parentb8a2042aa938069e862750553db0e4d82d25822c (diff)
Notes
Diffstat (limited to 'lib/Support/Mutex.cpp')
-rw-r--r--lib/Support/Mutex.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/Support/Mutex.cpp b/lib/Support/Mutex.cpp
index b1d5e7c0d991..7138c7a4b984 100644
--- a/lib/Support/Mutex.cpp
+++ b/lib/Support/Mutex.cpp
@@ -12,8 +12,8 @@
//===----------------------------------------------------------------------===//
#include "llvm/Support/Mutex.h"
-#include "llvm/Support/ErrorHandling.h"
#include "llvm/Config/config.h"
+#include "llvm/Support/ErrorHandling.h"
//===----------------------------------------------------------------------===//
//=== WARNING: Implementation here must contain only TRULY operating system
@@ -47,10 +47,7 @@ MutexImpl::MutexImpl( bool recursive)
{
// Declare the pthread_mutex data structures
pthread_mutex_t* mutex =
- static_cast<pthread_mutex_t*>(malloc(sizeof(pthread_mutex_t)));
-
- if (mutex == nullptr)
- report_bad_alloc_error("Mutex allocation failed");
+ static_cast<pthread_mutex_t*>(safe_malloc(sizeof(pthread_mutex_t)));
pthread_mutexattr_t attr;
@@ -119,9 +116,9 @@ MutexImpl::tryacquire()
#elif defined(LLVM_ON_UNIX)
#include "Unix/Mutex.inc"
-#elif defined( LLVM_ON_WIN32)
+#elif defined( _WIN32)
#include "Windows/Mutex.inc"
#else
-#warning Neither LLVM_ON_UNIX nor LLVM_ON_WIN32 was set in Support/Mutex.cpp
+#warning Neither LLVM_ON_UNIX nor _WIN32 was set in Support/Mutex.cpp
#endif
#endif