r368149 - Replace llvm::MutexGuard/UniqueLock with their standard equivalents
Benjamin Kramer via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 7 03:57:25 PDT 2019
Author: d0k
Date: Wed Aug 7 03:57:25 2019
New Revision: 368149
URL: http://llvm.org/viewvc/llvm-project?rev=368149&view=rev
Log:
Replace llvm::MutexGuard/UniqueLock with their standard equivalents
All supported platforms have <mutex> now, so we don't need our own
copies any longer. No functionality change intended.
Modified:
cfe/trunk/lib/Frontend/PrecompiledPreamble.cpp
cfe/trunk/tools/libclang/CIndexer.cpp
cfe/trunk/tools/libclang/Indexing.cpp
Modified: cfe/trunk/lib/Frontend/PrecompiledPreamble.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PrecompiledPreamble.cpp?rev=368149&r1=368148&r2=368149&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PrecompiledPreamble.cpp (original)
+++ cfe/trunk/lib/Frontend/PrecompiledPreamble.cpp Wed Aug 7 03:57:25 2019
@@ -28,10 +28,10 @@
#include "llvm/Support/CrashRecoveryContext.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Mutex.h"
-#include "llvm/Support/MutexGuard.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/VirtualFileSystem.h"
#include <limits>
+#include <mutex>
#include <utility>
using namespace clang;
@@ -106,20 +106,20 @@ TemporaryFiles &TemporaryFiles::getInsta
}
TemporaryFiles::~TemporaryFiles() {
- llvm::MutexGuard Guard(Mutex);
+ std::lock_guard<llvm::sys::Mutex> Guard(Mutex);
for (const auto &File : Files)
llvm::sys::fs::remove(File.getKey());
}
void TemporaryFiles::addFile(StringRef File) {
- llvm::MutexGuard Guard(Mutex);
+ std::lock_guard<llvm::sys::Mutex> Guard(Mutex);
auto IsInserted = Files.insert(File).second;
(void)IsInserted;
assert(IsInserted && "File has already been added");
}
void TemporaryFiles::removeFile(StringRef File) {
- llvm::MutexGuard Guard(Mutex);
+ std::lock_guard<llvm::sys::Mutex> Guard(Mutex);
auto WasPresent = Files.erase(File);
(void)WasPresent;
assert(WasPresent && "File was not tracked");
Modified: cfe/trunk/tools/libclang/CIndexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndexer.cpp?rev=368149&r1=368148&r2=368149&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndexer.cpp (original)
+++ cfe/trunk/tools/libclang/CIndexer.cpp Wed Aug 7 03:57:25 2019
@@ -18,11 +18,11 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/MD5.h"
-#include "llvm/Support/MutexGuard.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Program.h"
#include "llvm/Support/YAMLParser.h"
#include <cstdio>
+#include <mutex>
#ifdef __CYGWIN__
#include <cygwin/version.h>
Modified: cfe/trunk/tools/libclang/Indexing.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/Indexing.cpp?rev=368149&r1=368148&r2=368149&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/Indexing.cpp (original)
+++ cfe/trunk/tools/libclang/Indexing.cpp Wed Aug 7 03:57:25 2019
@@ -29,8 +29,8 @@
#include "llvm/Support/CrashRecoveryContext.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Mutex.h"
-#include "llvm/Support/MutexGuard.h"
#include <cstdio>
+#include <mutex>
#include <utility>
using namespace clang;
@@ -132,12 +132,12 @@ public:
}
void copyTo(PPRegionSetTy &Set) {
- llvm::MutexGuard MG(Mux);
+ std::lock_guard<llvm::sys::Mutex> MG(Mux);
Set = ParsedRegions;
}
void update(ArrayRef<PPRegion> Regions) {
- llvm::MutexGuard MG(Mux);
+ std::lock_guard<llvm::sys::Mutex> MG(Mux);
ParsedRegions.insert(Regions.begin(), Regions.end());
}
};
More information about the cfe-commits
mailing list