================ @@ -0,0 +1,81 @@ +.. title:: clang-tidy - modernize-use-scoped-lock + +modernize-use-scoped-lock +========================= + +Finds uses of ``std::lock_guard`` and suggests replacing them with C++17's more +flexible and safer alternative ``std::scoped_lock``. The check will +automatically transform only single declarations of ``std::lock_guard`` and +emit warnings for multiple declarations of ``std::lock_guard`` that can be +replaced with a single declaration of ``std::scoped_lock``. + +Examples +-------- + +Single ``std::lock_guard`` declaration: + +.. code-block:: c++ + + std::mutex M; + std::lock_guard<std::mutex> L(M); + + +Transforms to: + +.. code-block:: c++ + + std::mutex m; ---------------- PiotrZSL wrote:
```suggestion std::mutex M; ``` https://github.com/llvm/llvm-project/pull/126434 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits