This is an archive of the discontinued LLVM Phabricator instance.

[Clang-tidy] Comparison Function Address
AbandonedPublic

Authored by xazax.hun on Aug 11 2016, 1:49 PM.

Details

Reviewers
hokein
falho
Summary

The checker warns in case the address of a function is compared

Diff Detail

Event Timeline

falho updated this revision to Diff 67741.Aug 11 2016, 1:49 PM
falho retitled this revision from to Comparison Function Address.
falho updated this object.
Eugene.Zelenko retitled this revision from Comparison Function Address to [Clang-tidy] Comparison Function Address.Aug 11 2016, 1:51 PM
Eugene.Zelenko set the repository for this revision to rL LLVM.

Please mention this check in docs/ReleaseNotes.rst (in alphabetical order).

If I'm not mistaken, GCC or Clang has warning that result of comparison is always true for such situations.

clang-tidy/misc/ComparisonFunctionAddressCheck.h
19

Please lowercase Checker. Add add spaces across == below.

docs/clang-tidy/checks/misc-comparison-function-address.rst
6

Please lowercase Checker.

7

Please add space across ==. Please also run Clang-format over examples code.

18

Please highlight nullptr with ``.

test/clang-tidy/misc-comparison-function-address.cpp
16

Unnecessary empty line.

30

Unnecessary empty line.

Clang-tidy terminology use checks, not checkers.

This check looks like specific case of D23427. May be they should be merged?

hokein edited edge metadata.Aug 12 2016, 4:19 AM

This check looks like specific case of D23427. May be they should be merged?

+1, I think this check can be merged there.

test/clang-tidy/misc-comparison-function-address.cpp
20

How about the case if (getc == func)?

Hi Benedek, could you do the merge or should anybody commandeer these revisions?

xazax.hun commandeered this revision.Feb 13 2017, 3:01 AM
xazax.hun added a reviewer: falho.
xazax.hun abandoned this revision.Feb 13 2017, 3:01 AM

-Wtautological-pointer-compare already covers this case.