[clang-tidy] new check: bugprone-branch-clone
authorJonas Toth <jonas.toth@gmail.com>
Wed, 5 Dec 2018 09:16:25 +0000 (09:16 +0000)
committerJonas Toth <jonas.toth@gmail.com>
Wed, 5 Dec 2018 09:16:25 +0000 (09:16 +0000)
commitcd207f155206f171b402fcba37b2d1adad403ef0
tree8535e9796af6cbcb22d0a5a11592f52664b74fd8
parent45562a3aba4e8240a6d3949d0befdb64211a3913
[clang-tidy] new check: bugprone-branch-clone

Summary:
Implement a check for detecting if/else if/else chains where two or more
branches are Type I clones of each other (that is, they contain identical code)
and for detecting switch statements where two or more consecutive branches are
Type I clones of each other.

Patch by donat.nagy.

Reviewers: alexfh, hokein, aaron.ballman, JonasToth

Reviewed By: JonasToth

Subscribers: MTC, lebedev.ri, whisperity, xazax.hun, Eugene.Zelenko, mgorny, rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

Tags: #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D54757

llvm-svn: 348343
clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp [new file with mode: 0644]
clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.h [new file with mode: 0644]
clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
clang-tools-extra/docs/ReleaseNotes.rst
clang-tools-extra/docs/clang-tidy/checks/bugprone-branch-clone.rst [new file with mode: 0644]
clang-tools-extra/docs/clang-tidy/checks/list.rst
clang-tools-extra/test/clang-tidy/bugprone-branch-clone.cpp [new file with mode: 0644]