[PATCH] D54757: [clang-tidy] new check: bugprone-branch-clone

Eugene Zelenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 20 10:43:54 PST 2018


Eugene.Zelenko added inline comments.


================
Comment at: clang-tidy/bugprone/BranchCloneCheck.cpp:19
+
+namespace {
+
----------------
Please use anonymous namespaces only for type declarations. See LLV coding style guide.


================
Comment at: clang-tidy/bugprone/BranchCloneCheck.cpp:43
+
+  for (unsigned i = 0; i < LHS.size(); i++) {
+    if (!areStatementsIdentical(LHS[i]->stripLabelLikeStatements(),
----------------
Please use size_t.


================
Comment at: clang-tidy/bugprone/BranchCloneCheck.cpp:122
+
+    const int N = Branches.size();
+    llvm::BitVector KnownAsClone(N);
----------------
Please use size_t. Same for loop variables. Clang complains about such conversions.


================
Comment at: docs/ReleaseNotes.rst:70
 
+- New :doc:`bugprone-branch-clone
+  <clang-tidy/checks/bugprone-branch-clone>` check.
----------------
Please use alphabetical order for new checks list.


================
Comment at: docs/clang-tidy/checks/bugprone-branch-clone.rst:6
+
+Finds ``if/else if/else`` chains where two or more branches are Type I clones
+of each other (that is, they contain identical code) and ``switch`` statements
----------------
Please first statement same as Release Notes.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D54757





More information about the cfe-commits mailing list