Author: Paul Kirth Date: 2025-04-14T17:27:03-07:00 New Revision: 9cdc3aab3eae55be30003cb486f290f3ee3df3a8
URL: https://github.com/llvm/llvm-project/commit/9cdc3aab3eae55be30003cb486f290f3ee3df3a8 DIFF: https://github.com/llvm/llvm-project/commit/9cdc3aab3eae55be30003cb486f290f3ee3df3a8.diff LOG: [clang-doc] Use SmartMutex when visiting the AST (#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. Added: Modified: clang-tools-extra/clang-doc/Mapper.cpp Removed: ################################################################################ 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