[llvm] [ADT] Use std::scoped_lock in ConcurrentHashtable (NFC) (PR #165100)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 25 08:32:24 PDT 2025


================
@@ -177,7 +177,7 @@ class ConcurrentHashTableByPtr {
 
 #if LLVM_ENABLE_THREADS
     // Lock bucket.
-    CurBucket.Guard.lock();
+    std::scoped_lock<std::mutex> Lock(CurBucket.Guard);
----------------
kazutakahirata wrote:

No, not quite in the `-DLLVM_ENABLE_WERROR=On` setup:

```
llvm/include/llvm/ADT/ConcurrentHashtable.h:180:5: error: 'std::scoped_lock' may not intend to support class template argument deduction [-Werror,-Wctad-maybe-unsupported]
  180 |     std::scoped_lock Lock(CurBucket.Guard);
      |     ^
```

Thanks for reviews as always!


https://github.com/llvm/llvm-project/pull/165100


More information about the llvm-commits mailing list