[clang] [clang-tools-extra] [analyzer] Remove alpha.core.IdenticalExpr Checker (PR #114715)

Congcong Cai via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 16 21:38:58 PST 2024


================
@@ -269,6 +473,21 @@ void BranchCloneCheck::check(const MatchFinder::MatchResult &Result) {
     return;
   }
 
+  if (const auto *IS = Result.Nodes.getNodeAs<IfStmt>("ifWithDescendantIf")) {
+    const Stmt *Then = IS->getThen();
+    auto CS = dyn_cast<CompoundStmt>(Then);
+    if (CS && (!CS->body_empty())) {
+      const auto *InnerIf = dyn_cast<IfStmt>(*CS->body_begin());
+      if (InnerIf && isIdenticalStmt(Context, IS->getCond(), InnerIf->getCond(),
+                                     /*IgnoreSideEffects=*/false)) {
----------------
HerrCai0907 wrote:

I mean we can do this check in ast_matcher to reduce the cost

https://github.com/llvm/llvm-project/pull/114715


More information about the cfe-commits mailing list