This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] `bugprone-use-after-move`: Don't warn on self-moves.
ClosedPublic

Authored by mboehme on Jun 1 2022, 9:52 PM.

Diff Detail

Event Timeline

mboehme created this revision.Jun 1 2022, 9:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 1 2022, 9:52 PM
mboehme requested review of this revision.Jun 1 2022, 9:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 1 2022, 9:52 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
sammccall accepted this revision.Jun 3 2022, 4:22 AM
This revision is now accepted and ready to land.Jun 3 2022, 4:22 AM
njames93 accepted this revision.Jun 3 2022, 8:12 AM

LGTM.

I feel that this case should produce a warning akin to the no self assignment diagnostics, obviously nothing to do with this check though.

mboehme updated this revision to Diff 434739.Jun 7 2022, 2:00 AM

Added release notes.

The reviewer on https://reviews.llvm.org/D126780 reminded me to add release notes, so I've done so here as well. I assume this does not require another round of review.

LGTM.

I feel that this case should produce a warning akin to the no self assignment diagnostics, obviously nothing to do with this check though.

Makes sense -- acknowledged.

FWIW, the use case that prompted me to make this change was a test for the move assignment operator where clang-tidy was erroneously flagging the self-move as a use-after-move. Self-moves shouldn't occur outside of test code though, and it would be good to have some check produce a warning for them.