[PATCH] D128402: [clang-tidy] Don't treat invalid branches as identical

Eugene Zelenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 22 21:50:18 PDT 2022


Eugene.Zelenko added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp:26
+    // of the left and right statements.
+    const Expr *LHSExpr = llvm::dyn_cast<Expr>(LHS);
+    const Expr *RHSExpr = llvm::dyn_cast<Expr>(RHS);
----------------
`auto` could be used because type is spelled in same statement.


================
Comment at: clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp:27
+    const Expr *LHSExpr = llvm::dyn_cast<Expr>(LHS);
+    const Expr *RHSExpr = llvm::dyn_cast<Expr>(RHS);
+    if (LHSExpr->containsErrors() && RHSExpr->containsErrors()) {
----------------
Ditto.


================
Comment at: clang-tools-extra/docs/ReleaseNotes.rst:236
 
+- Fixed a false positive in :doc:`bugprone-branch-clone
+  <clang-tidy/checks/bugprone-branch-clone>` when the branches
----------------
Documentation path was changed recently. Please also keep alphabetical order inside section.


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

https://reviews.llvm.org/D128402



More information about the cfe-commits mailing list