https://github.com/ilovepi created https://github.com/llvm/llvm-project/pull/135514
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. >From f3a86d88bd89ba281fc301734ef24a79d9821f7b Mon Sep 17 00:00:00 2001 From: Paul Kirth <paulki...@google.com> Date: Sat, 12 Apr 2025 19:12:06 -0700 Subject: [PATCH] [clang-doc][NFC] Use SmartMutex when visiting the AST 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. --- clang-tools-extra/clang-doc/Mapper.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits