The check warns if an object is used after it has been moved, without an
intervening reinitialization.
See user-facing documentation for details.
Paths
| Differential D23353
[clang-tidy] Add check 'misc-use-after-move' ClosedPublic Authored by mboehme on Aug 10 2016, 8:29 AM.
Details Summary The check warns if an object is used after it has been moved, without an See user-facing documentation for details.
Diff Detail Event Timelinemboehme updated this object. Comment Actions Apologies for the size of this patch. alexfh@ said he was willing to review it as-is -- however, I'm happy to resubmit in smaller pieces if necessary. fowles added inline comments. Comment Actions I will review it later, but my first thoughts:
Eugene.Zelenko added inline comments.
Comment Actions A few initial comments.
mboehme added inline comments.
Comment Actions
Agree that "misc" seems pretty overcrowded. I'll defer to those who have been working on clang-tidy longer than me to make this call.
How exactly would I create such a "link"? Are you just thinking of a link in the documentation, or is there a way to have one clang-tidy check activate another (and is this what you're thinking of)? omtcyfz added inline comments.
Comment Actions
I am not sure if there is any other mechanism than just links in documentation.
alexfh edited edge metadata. alexfh added inline comments.
This revision now requires changes to proceed.Aug 17 2016, 10:29 AM mboehme added a parent revision: D23842: [CFG] Add iterator_ranges to CFG and CFGBlock..Aug 25 2016, 1:43 AM Comment Actions
I've taken a look, but I'm not sure where I would put this link. I could add another file that starts with "cppcoreguidelines-", but that would make it look as if an actual check with that name exists, and I'm not sure that's what we want. Do you have a suggestion?
Do you have a pointer to something in CppCoreGuidelines that says this explicitly? The closest I've been able to find is in F.18: "Flag access to moved-from objects." It's not entirely clear here whether "access" is meant to include reinitialization. However, other parts of CppCoreGuidelines seem to imply that it _is_ OK to reinitialize an object: From ES.56: And from C.64:
alexfh edited edge metadata. Comment ActionsLG
This revision is now accepted and ready to land.Sep 7 2016, 5:13 AM mboehme marked 6 inline comments as done. mboehme edited edge metadata. Comment ActionsResponses to reviewer comments. Closed by commit rL281453: [clang-tidy] Add check 'misc-use-after-move' (authored by mboehme). · Explain WhySep 14 2016, 3:38 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 67524 clang-tidy/misc/CMakeLists.txt
clang-tidy/misc/MiscTidyModule.cpp
clang-tidy/misc/UseAfterMoveCheck.h
clang-tidy/misc/UseAfterMoveCheck.cpp
docs/ReleaseNotes.rst
docs/clang-tidy/checks/list.rst
docs/clang-tidy/checks/misc-use-after-move.rst
test/clang-tidy/misc-use-after-move.cpp
|
Please enclose inline code snippets in double backquotes (doxygen supports markdown to a certain degree).