denzor200 wrote: > Wouldn't that be a runtime check, and thus not something clang-tidy can do > without significant data flow analysis effort?
I'm not experienced enough in clang-tidy internals, but I believe it will not be a serious challenge to check for having `assert(sp.use_count() == 1)` one line before `*sp` being moved. I suppose everybody agree that this snippet ``` assert(sp.use_count() == 1); auto y = std::move(*sp); ``` ..is better than that one: ``` // NOLINTNEXTLINE(clang-tidy-bugprone-move-shared-pointer-contents) auto y = std::move(*sp); ``` https://github.com/llvm/llvm-project/pull/67467 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits