2 ms·
Absolutely. The following two new checks are impressive and should be on by default. New misc-move-forwarding-reference check Warns when std::move is applied t
by danieljh 10y ago
Absolutely. The following two new checks are impressive and should be on by default.
New misc-move-forwarding-reference check
Warns when std::move is applied to a forwarding reference instead of std::forward.
http://clang.llvm.org/extra/clang-tidy/checks/misc-move-forwarding-reference.html http://clang.llvm.org/extra/clang-tidy/checks/misc-move-forw...
New misc-use-after-move check
Warns if an object is used after it has been moved, without an intervening reinitialization.
http://clang.llvm.org/extra/clang-tidy/checks/misc-use-after-move.html http://clang.llvm.org/extra/clang-tidy/checks/misc-use-after...
The use-after-move check has its limitations which make sense considering the "unspecified but valid state" moved from objects are in. From reading the design document the cases they handle should catch common ownership issues, though. Great step in the right direction for sure.
Implementation: https://github.com/llvm-mirror/clang-tools-extra/blob/master/clang-tidy/misc/UseAfterMoveCheck.cpp https://github.com/llvm-mirror/clang-tools-extra/blob/master...
Related: https://doc.rust-lang.org/book/ownership.html https://doc.rust-lang.org/book/ownership.html