This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Ignore expressions with incompatible deleters.
ClosedPublic

Authored by sbenza on Mar 18 2015, 11:47 AM.

Details

Summary

Do not warn on .reset(.release()) expressions if the deleters are not
compatible.
Using plain assignment will probably not work.

Diff Detail

Event Timeline

sbenza updated this revision to Diff 22199.Mar 18 2015, 11:47 AM
sbenza retitled this revision from to [clang-tidy] Ignore expressions with incompatible deleters..
sbenza updated this object.
sbenza edited the test plan for this revision. (Show Details)
sbenza added a reviewer: klimek.
sbenza added a subscriber: Unknown Object (MLST).
sbenza edited reviewers, added: alexfh; removed: klimek.Mar 24 2015, 8:27 AM
alexfh accepted this revision.Mar 31 2015, 7:30 AM
alexfh edited edge metadata.

Looks good!

clang-tidy/misc/UniqueptrResetReleaseCheck.cpp
43

nit: put return on the next line.

50

nit: I'd use the concrete type here.

52

Can this only happen if unique_ptr is defined in a nonstandard way?

102

nit: Why another empty line?

This revision is now accepted and ready to land.Mar 31 2015, 7:30 AM
sbenza updated this revision to Diff 23377.Apr 7 2015, 3:56 PM
sbenza edited edge metadata.

Minor fixes

clang-tidy/misc/UniqueptrResetReleaseCheck.cpp
43

Done. And another one 2 lines below. clang-format fixed it for me.

50

Done.

52

The deleter could be a function pointer.

102

clang-format to the rescue.

alexfh added inline comments.Apr 8 2015, 5:36 AM
clang-tidy/misc/UniqueptrResetReleaseCheck.cpp
52

Ah, I see. But then we can also check if the function pointers are compatible and allow the fix, can't we?

sbenza updated this revision to Diff 23496.Apr 9 2015, 9:49 AM

Added support for function pointers.

clang-tidy/misc/UniqueptrResetReleaseCheck.cpp
52

Done

sbenza updated this revision to Diff 23499.Apr 9 2015, 10:04 AM

Format fix

This revision was automatically updated to reflect the committed changes.