[clang-tools-extra] [clang-tidy] Fix smart pointers handling in bugprone-use-after-move (PR #94869)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 11 01:13:14 PDT 2024
martinboehme wrote:
More extensive comments on #90174 (let's continue the discussion there), but briefly:
> * Removed custom smart pointers handling (were hiding issues)
The standard smart pointers have a well-defined moved-from state (they are defined to be null after a move). Programmers may intentionally rely on this defined behavior. Warning on a (non-dereferencing) use-after-move for smart pointers as we do for other types would therefore result in false positives.
> * Changed 'move occurred here' note location to always point to 'std::move'
As discussed in more detail on #90174, the move doesn't actually occur in the `std::move()` (which is just a cast), and this can be important when sequencing rules come into play.
https://github.com/llvm/llvm-project/pull/94869
More information about the cfe-commits
mailing list