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

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 29 10:59:08 PST 2018


JonasToth added inline comments.


================
Comment at: clang-tidy/bugprone/BranchCloneCheck.cpp:31
+/// an if/else if/else chain is one statement (which may be a CompoundStmt).
+using SwitchBranch = llvm::SmallVector<const Stmt *, 2>;
+} // anonymous namespace
----------------
donat.nagy wrote:
> JonasToth wrote:
> > maybe plural for the typename would fit better, as its a vector of multiple elements?
> This type represents one branch in a switch statement (which consists of multiple statements). I cannot think of a descriptive, short name which also happens to be plural and I do not want to use a monstrosity like `StatementsInSwitchBranch`.
> 
> By the way, can anyone think of shorter, but still clear names for `areStatementsIdentical()` and `areSwitchBranchesIdentical()` ?
The name is ok, I missunderstood the sense of the type.
Your other names are fine i think.


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54757/new/

https://reviews.llvm.org/D54757





More information about the cfe-commits mailing list