]> granicus.if.org Git - clang/commitdiff
Remove LLVM mutexes from clang in favor of std::mutex
authorBenjamin Kramer <benny.kra@googlemail.com>
Wed, 7 Aug 2019 14:44:40 +0000 (14:44 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Wed, 7 Aug 2019 14:44:40 +0000 (14:44 +0000)
None of those need to be recursive mutexes. No functionality change
intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@368173 91177308-0d34-0410-b5e6-96231b3b80d8

lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
lib/Frontend/PrecompiledPreamble.cpp
tools/libclang/CIndex.cpp
tools/libclang/CIndexer.h
unittests/DirectoryWatcher/DirectoryWatcherTest.cpp

index 865c2b33bf9f791aa8acf84924e28fa678182784..f44ce494d9bcb1997d2d1ee9e261881d54b24b4c 100644 (file)
@@ -14,7 +14,6 @@
 #include "llvm/Support/AlignOf.h"
 #include "llvm/Support/Errno.h"
 #include "llvm/Support/Error.h"
-#include "llvm/Support/Mutex.h"
 #include "llvm/Support/Path.h"
 #include <atomic>
 #include <condition_variable>
index 93f19294dc0afa632cbd1ae64ca1e2a8fe43b709..6b174065d11bced3691cd3b5c68359661ed8bc83 100644 (file)
@@ -27,7 +27,6 @@
 #include "llvm/Config/llvm-config.h"
 #include "llvm/Support/CrashRecoveryContext.h"
 #include "llvm/Support/FileSystem.h"
-#include "llvm/Support/Mutex.h"
 #include "llvm/Support/Process.h"
 #include "llvm/Support/VirtualFileSystem.h"
 #include <limits>
@@ -96,7 +95,7 @@ public:
   void removeFile(StringRef File);
 
 private:
-  llvm::sys::SmartMutex<false> Mutex;
+  std::mutex Mutex;
   llvm::StringSet<> Files;
 };
 
@@ -106,20 +105,20 @@ TemporaryFiles &TemporaryFiles::getInstance() {
 }
 
 TemporaryFiles::~TemporaryFiles() {
-  std::lock_guard<llvm::sys::Mutex> Guard(Mutex);
+  std::lock_guard<std::mutex> Guard(Mutex);
   for (const auto &File : Files)
     llvm::sys::fs::remove(File.getKey());
 }
 
 void TemporaryFiles::addFile(StringRef File) {
-  std::lock_guard<llvm::sys::Mutex> Guard(Mutex);
+  std::lock_guard<std::mutex> Guard(Mutex);
   auto IsInserted = Files.insert(File).second;
   (void)IsInserted;
   assert(IsInserted && "File has already been added");
 }
 
 void TemporaryFiles::removeFile(StringRef File) {
-  std::lock_guard<llvm::sys::Mutex> Guard(Mutex);
+  std::lock_guard<std::mutex> Guard(Mutex);
   auto WasPresent = Files.erase(File);
   (void)WasPresent;
   assert(WasPresent && "File was not tracked");
index 1da0ab1a27c86174bd61ff7cea558fe1feb89338..7c6ae9163207f45b3086bb020a416e4c522dd43f 100644 (file)
@@ -45,7 +45,6 @@
 #include "llvm/Support/Format.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/MemoryBuffer.h"
-#include "llvm/Support/Mutex.h"
 #include "llvm/Support/Program.h"
 #include "llvm/Support/SaveAndRestore.h"
 #include "llvm/Support/Signals.h"
@@ -53,6 +52,7 @@
 #include "llvm/Support/Threading.h"
 #include "llvm/Support/Timer.h"
 #include "llvm/Support/raw_ostream.h"
+#include <mutex>
 
 #if LLVM_ENABLE_THREADS != 0 && defined(__APPLE__)
 #define USE_DARWIN_THREADS
@@ -8943,10 +8943,10 @@ Logger &cxindex::Logger::operator<<(const llvm::format_object_base &Fmt) {
   return *this;
 }
 
-static llvm::ManagedStatic<llvm::sys::Mutex> LoggingMutex;
+static llvm::ManagedStatic<std::mutex> LoggingMutex;
 
 cxindex::Logger::~Logger() {
-  llvm::sys::ScopedLock L(*LoggingMutex);
+  std::lock_guard<std::mutex> L(*LoggingMutex);
 
   static llvm::TimeRecord sBeginTR = llvm::TimeRecord::getCurrentTime();
 
index b7dd5f8acec6fac40a964bb289dc2e81cdab8d3a..8a926fd2d9e5e5093082a58cd2b65e3420b69964 100644 (file)
@@ -17,7 +17,6 @@
 #include "clang-c/Index.h"
 #include "clang/Frontend/PCHContainerOperations.h"
 #include "llvm/ADT/STLExtras.h"
-#include "llvm/Support/Mutex.h"
 #include <utility>
 
 namespace llvm {
index 485f0eeab05a65c91012daf530b2d0d2e41da928..6dc9ab994c990869525303fb5c0f2c78fb8eee7e 100644 (file)
@@ -8,7 +8,6 @@
 
 #include "clang/DirectoryWatcher/DirectoryWatcher.h"
 #include "llvm/Support/FileSystem.h"
-#include "llvm/Support/Mutex.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/raw_ostream.h"
 #include "gtest/gtest.h"