llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-tools-extra

Author: Paul Kirth (ilovepi)

<details>
<summary>Changes</summary>

The SmartMutex will allow us to have a cheap mutex implementation when
using the Standalone executor, since it's single threaded. Performance
should be about the same for AllTUs executor.

---
Full diff: https://github.com/llvm/llvm-project/pull/135514.diff


1 Files Affected:

- (modified) clang-tools-extra/clang-doc/Mapper.cpp (+2-2) 


``````````diff
diff --git a/clang-tools-extra/clang-doc/Mapper.cpp 
b/clang-tools-extra/clang-doc/Mapper.cpp
index 6c90db03424c6..022e3b12d82bc 100644
--- a/clang-tools-extra/clang-doc/Mapper.cpp
+++ b/clang-tools-extra/clang-doc/Mapper.cpp
@@ -19,7 +19,7 @@ namespace clang {
 namespace doc {
 
 static llvm::StringSet<> USRVisited;
-static llvm::sys::Mutex USRVisitedGuard;
+static llvm::sys::SmartMutex<true> USRVisitedGuard;
 
 template <typename T> bool isTypedefAnonRecord(const T *D) {
   if (const auto *C = dyn_cast<CXXRecordDecl>(D)) {
@@ -48,7 +48,7 @@ bool MapASTVisitor::mapDecl(const T *D, bool IsDefinition) {
     return true;
   // Prevent Visiting USR twice
   {
-    std::lock_guard<llvm::sys::Mutex> Guard(USRVisitedGuard);
+    llvm::sys::SmartScopedLock<true> Guard(USRVisitedGuard);
     StringRef Visited = USR.str();
     if (USRVisited.count(Visited) && !isTypedefAnonRecord<T>(D))
       return true;

``````````

</details>


https://github.com/llvm/llvm-project/pull/135514
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to