[clang] [clang]Remove unused variable (PR #211983)

Hardik Kumar via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 24 21:34:39 PDT 2026


https://github.com/hardikxk updated https://github.com/llvm/llvm-project/pull/211983

>From 347f53508282f6a564261e6f29b58a404b0fc91d Mon Sep 17 00:00:00 2001
From: Hardik Kumar <hardikxk at gmail.com>
Date: Sat, 25 Jul 2026 09:51:12 +0530
Subject: [PATCH 1/2] Remove unused variable A count variable was set and
 incremented inside of a for loop but never actually used inside of the loop
 or anywhere else in its scope.

---
 .../Checkers/RetainCountChecker/RetainCountDiagnostics.cpp    | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
index 0eee742fa0da3..c0a0c53be0f56 100644
--- a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
@@ -501,9 +501,7 @@ RefCountReportVisitor::VisitNode(const ExplodedNode *N, BugReporterContext &BRC,
     if (const CallExpr *CE = dyn_cast<CallExpr>(S)) {
       // Iterate through the parameter expressions and see if the symbol
       // was ever passed as an argument.
-      unsigned i = 0;
-
-      for (auto AI=CE->arg_begin(), AE=CE->arg_end(); AI!=AE; ++AI, ++i) {
+      for (auto AI=CE->arg_begin(), AE=CE->arg_end(); AI!=AE; ++AI) {
 
         // Retrieve the value of the argument.  Is it the symbol
         // we are interested in?

>From a3d821e2b012af484af35dcb316a3c0c48f45d0a Mon Sep 17 00:00:00 2001
From: Hardik Kumar <hardikxk at gmail.com>
Date: Sat, 25 Jul 2026 10:04:24 +0530
Subject: [PATCH 2/2] yafc

---
 .../Checkers/RetainCountChecker/RetainCountDiagnostics.cpp      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
index c0a0c53be0f56..0b7c8f5f69a38 100644
--- a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
@@ -501,7 +501,7 @@ RefCountReportVisitor::VisitNode(const ExplodedNode *N, BugReporterContext &BRC,
     if (const CallExpr *CE = dyn_cast<CallExpr>(S)) {
       // Iterate through the parameter expressions and see if the symbol
       // was ever passed as an argument.
-      for (auto AI=CE->arg_begin(), AE=CE->arg_end(); AI!=AE; ++AI) {
+      for (auto AI = CE->arg_begin(), AE = CE->arg_end(); AI != AE; ++AI) {
 
         // Retrieve the value of the argument.  Is it the symbol
         // we are interested in?



More information about the cfe-commits mailing list