This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Extend misc-use-after-move to support unique_ptr and shared_ptr.
ClosedPublic

Authored by mboehme on Oct 27 2016, 12:19 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

mboehme updated this revision to Diff 76081.Oct 27 2016, 12:19 PM
mboehme retitled this revision from to [clang-tidy] Extend misc-use-after-move to support unique_ptr and shared_ptr..
mboehme updated this object.
mboehme added a reviewer: alexfh.
mboehme added a subscriber: cfe-commits.
Eugene.Zelenko set the repository for this revision to rL LLVM.
Eugene.Zelenko added a subscriber: Prazek.
aaron.ballman added inline comments.Oct 31 2016, 7:27 AM
clang-tidy/misc/UseAfterMoveCheck.cpp
467 ↗(On Diff #76081)

This logic could be improved as:

if (const auto *ID = ND->getIdentifier())
  return ID->getName();
return "";

However, I'm not certain that this function is needed at all -- it's pretty simple and is only used from isStandardSmartPointer().

482 ↗(On Diff #76081)

Shouldn't this improvement also include weak_ptr?

542 ↗(On Diff #76081)

And ::std::weak_ptr?

alexfh accepted this revision.Oct 31 2016, 7:34 AM
alexfh edited edge metadata.

LG modulo comments.

clang-tidy/misc/UseAfterMoveCheck.cpp
498 ↗(On Diff #76081)

Use ArrayRef instead of const SmallVectorImpl<> &.

This revision is now accepted and ready to land.Oct 31 2016, 7:34 AM
mboehme updated this revision to Diff 76655.Nov 1 2016, 4:56 PM
mboehme edited edge metadata.
  • Responses to reviewer comments
mboehme marked 4 inline comments as done.Nov 1 2016, 5:05 PM

Please take another look.

clang-tidy/misc/UseAfterMoveCheck.cpp
467 ↗(On Diff #76081)

However, I'm not certain that this function is needed at all -- it's pretty simple and is only used from isStandardSmartPointer().

Good point -- I've inlined it there.

482 ↗(On Diff #76081)

Good point -- done.

aaron.ballman accepted this revision.Nov 2 2016, 9:50 AM
aaron.ballman edited edge metadata.

LGTM, thank you!

This revision was automatically updated to reflect the committed changes.
mboehme marked 2 inline comments as done.