[clang-tools-extra] [clang-tidy] Add bugprone-move-shared-pointer-contents check. (PR #67467)

Piotr Zegar via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 10 13:02:56 PDT 2024


================
@@ -0,0 +1,19 @@
+.. title:: clang-tidy - bugprone-move-shared-pointer-contents
+
+bugprone-move-shared-pointer-contents
+=====================================
+
+
+Detects calls to move the contents out of a ``std::shared_ptr`` rather
+than moving the pointer itself. In other words, calling
+``std::move(*p)`` or ``std::move(*p.get())``. Other reference holders
+may not be expecting the move and suddenly getting empty or otherwise
+indeterminate states can cause issues.
+
----------------
PiotrZSL wrote:

add info that check is restricted to C++11 and above.

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


More information about the cfe-commits mailing list