diff --git a/clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp b/clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp index 865c2b33bf9f..f44ce494d9bc 100644 --- a/clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp +++ b/clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp @@ -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 #include diff --git a/clang/lib/Frontend/PrecompiledPreamble.cpp b/clang/lib/Frontend/PrecompiledPreamble.cpp index 93f19294dc0a..6b174065d11b 100644 --- a/clang/lib/Frontend/PrecompiledPreamble.cpp +++ b/clang/lib/Frontend/PrecompiledPreamble.cpp @@ -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 @@ -96,7 +95,7 @@ public: void removeFile(StringRef File); private: - llvm::sys::SmartMutex Mutex; + std::mutex Mutex; llvm::StringSet<> Files; }; @@ -106,20 +105,20 @@ TemporaryFiles &TemporaryFiles::getInstance() { } TemporaryFiles::~TemporaryFiles() { - std::lock_guard Guard(Mutex); + std::lock_guard Guard(Mutex); for (const auto &File : Files) llvm::sys::fs::remove(File.getKey()); } void TemporaryFiles::addFile(StringRef File) { - std::lock_guard Guard(Mutex); + std::lock_guard 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 Guard(Mutex); + std::lock_guard Guard(Mutex); auto WasPresent = Files.erase(File); (void)WasPresent; assert(WasPresent && "File was not tracked"); diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index 1da0ab1a27c8..7c6ae9163207 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -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 #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 LoggingMutex; +static llvm::ManagedStatic LoggingMutex; cxindex::Logger::~Logger() { - llvm::sys::ScopedLock L(*LoggingMutex); + std::lock_guard L(*LoggingMutex); static llvm::TimeRecord sBeginTR = llvm::TimeRecord::getCurrentTime(); diff --git a/clang/tools/libclang/CIndexer.h b/clang/tools/libclang/CIndexer.h index b7dd5f8acec6..8a926fd2d9e5 100644 --- a/clang/tools/libclang/CIndexer.h +++ b/clang/tools/libclang/CIndexer.h @@ -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 namespace llvm { diff --git a/clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp b/clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp index 485f0eeab05a..6dc9ab994c99 100644 --- a/clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp +++ b/clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp @@ -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"