summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2019-08-07 11:59:44 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2019-08-07 11:59:44 +0000
commite57b60f321024064353b46489cfb25ee01fd55d7 (patch)
treeb71a61770bccc543c2d25ab846ea7e8acbb1cd34
parent45ee93323ba69b3ad01e9a9a70c6e61d5f9d2df5 (diff)
downloadbcm5719-llvm-e57b60f321024064353b46489cfb25ee01fd55d7.tar.gz
bcm5719-llvm-e57b60f321024064353b46489cfb25ee01fd55d7.zip
Replace non-recursive sys::Mutex users with std::mutex
Also remove a use of sys::MutexImpl, that's just evil. No functionality change intended. llvm-svn: 368157
-rw-r--r--clang/include/clang/Frontend/ASTUnit.h2
-rw-r--r--clang/lib/Frontend/ASTUnit.cpp10
-rw-r--r--clang/tools/libclang/Indexing.cpp8
-rw-r--r--llvm/unittests/IR/ValueMapTest.cpp4
4 files changed, 11 insertions, 13 deletions
diff --git a/clang/include/clang/Frontend/ASTUnit.h b/clang/include/clang/Frontend/ASTUnit.h
index 7fb1d2d9338..4491bf298c1 100644
--- a/clang/include/clang/Frontend/ASTUnit.h
+++ b/clang/include/clang/Frontend/ASTUnit.h
@@ -390,7 +390,7 @@ private:
/// just about any usage.
/// Becomes a noop in release mode; only useful for debug mode checking.
class ConcurrencyState {
- void *Mutex; // a llvm::sys::MutexImpl in debug;
+ void *Mutex; // a std::recursive_mutex in debug;
public:
ConcurrencyState();
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index df0d6d4fe5e..7e3f7a2f13f 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -85,7 +85,6 @@
#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
-#include "llvm/Support/Mutex.h"
#include "llvm/Support/Timer.h"
#include "llvm/Support/VirtualFileSystem.h"
#include "llvm/Support/raw_ostream.h"
@@ -96,6 +95,7 @@
#include <cstdio>
#include <cstdlib>
#include <memory>
+#include <mutex>
#include <string>
#include <tuple>
#include <utility>
@@ -2692,20 +2692,20 @@ InputKind ASTUnit::getInputKind() const {
#ifndef NDEBUG
ASTUnit::ConcurrencyState::ConcurrencyState() {
- Mutex = new llvm::sys::MutexImpl(/*recursive=*/true);
+ Mutex = new std::recursive_mutex;
}
ASTUnit::ConcurrencyState::~ConcurrencyState() {
- delete static_cast<llvm::sys::MutexImpl *>(Mutex);
+ delete static_cast<std::recursive_mutex *>(Mutex);
}
void ASTUnit::ConcurrencyState::start() {
- bool acquired = static_cast<llvm::sys::MutexImpl *>(Mutex)->tryacquire();
+ bool acquired = static_cast<std::recursive_mutex *>(Mutex)->try_lock();
assert(acquired && "Concurrent access to ASTUnit!");
}
void ASTUnit::ConcurrencyState::finish() {
- static_cast<llvm::sys::MutexImpl *>(Mutex)->release();
+ static_cast<std::recursive_mutex *>(Mutex)->unlock();
}
#else // NDEBUG
diff --git a/clang/tools/libclang/Indexing.cpp b/clang/tools/libclang/Indexing.cpp
index 36c08122052..1d30bbf6056 100644
--- a/clang/tools/libclang/Indexing.cpp
+++ b/clang/tools/libclang/Indexing.cpp
@@ -28,7 +28,6 @@
#include "clang/Lex/PreprocessorOptions.h"
#include "llvm/Support/CrashRecoveryContext.h"
#include "llvm/Support/MemoryBuffer.h"
-#include "llvm/Support/Mutex.h"
#include <cstdio>
#include <mutex>
#include <utility>
@@ -122,22 +121,21 @@ namespace llvm {
namespace {
class SessionSkipBodyData {
- llvm::sys::Mutex Mux;
+ std::mutex Mux;
PPRegionSetTy ParsedRegions;
public:
- SessionSkipBodyData() : Mux(/*recursive=*/false) {}
~SessionSkipBodyData() {
//llvm::errs() << "RegionData: " << Skipped.size() << " - " << Skipped.getMemorySize() << "\n";
}
void copyTo(PPRegionSetTy &Set) {
- std::lock_guard<llvm::sys::Mutex> MG(Mux);
+ std::lock_guard<std::mutex> MG(Mux);
Set = ParsedRegions;
}
void update(ArrayRef<PPRegion> Regions) {
- std::lock_guard<llvm::sys::Mutex> MG(Mux);
+ std::lock_guard<std::mutex> MG(Mux);
ParsedRegions.insert(Regions.begin(), Regions.end());
}
};
diff --git a/llvm/unittests/IR/ValueMapTest.cpp b/llvm/unittests/IR/ValueMapTest.cpp
index 9dcb4fa7fba..cfb37f0b8df 100644
--- a/llvm/unittests/IR/ValueMapTest.cpp
+++ b/llvm/unittests/IR/ValueMapTest.cpp
@@ -196,9 +196,9 @@ struct LockMutex : ValueMapConfig<KeyT, MutexT> {
// FIXME: These tests started failing on Windows.
#if LLVM_ENABLE_THREADS && !defined(_WIN32)
TYPED_TEST(ValueMapTest, LocksMutex) {
- sys::Mutex M(false); // Not recursive.
+ std::mutex M;
bool CalledRAUW = false, CalledDeleted = false;
- typedef LockMutex<TypeParam*, sys::Mutex> ConfigType;
+ typedef LockMutex<TypeParam*, std::mutex> ConfigType;
typename ConfigType::ExtraData Data = {&M, &CalledRAUW, &CalledDeleted};
ValueMap<TypeParam*, int, ConfigType> VM(Data);
VM[this->BitcastV.get()] = 7;
OpenPOWER on IntegriCloud