This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] New util `Aliasing` factored out from `bugprone-infinite-loop`
ClosedPublic

Authored by baloghadamsoftware on Jun 8 2020, 7:28 AM.

Details

Summary

Function hasPtrOrReferenceInfFunc() of bugprone-infinite-loop is a generic function which could be reused in another checks. This patch moves this function into a newly created utility module.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptJun 8 2020, 7:28 AM
gribozavr2 added inline comments.Jun 8 2020, 8:36 AM
clang-tools-extra/clang-tidy/utils/Aliasing.cpp
60

Please don't duplicate the comment from the header in the cpp file.

clang-tools-extra/clang-tidy/utils/Aliasing.h
19

Could you expand the comment? Best if you could add an example.

Thank you for the comment, @gribozavr2! Patch updated according to them.

gribozavr2 accepted this revision.Jun 9 2020, 7:55 AM
gribozavr2 added inline comments.
clang-tools-extra/clang-tidy/utils/Aliasing.h
30

Extra blank line.

This revision is now accepted and ready to land.Jun 9 2020, 7:55 AM
njames93 added inline comments.
clang-tools-extra/clang-tidy/utils/Aliasing.cpp
18

Ditto \p <Name>.

26

Ditto.

44

Ditto.

clang-tools-extra/clang-tidy/utils/Aliasing.h
19

Don't use double ticks for param names, instead use \p <Name>.

Parameters in comments changed to \p <Name>.

njames93 accepted this revision.Jun 10 2020, 5:41 AM

LGTM, but with one more nit

clang-tools-extra/clang-tidy/bugprone/InfiniteLoopCheck.cpp
16

This function is only used once in the file, so may as well remove this line and just qualify its call further down.

60

here.

This revision was automatically updated to reflect the committed changes.