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

The patch resolves the following warning.
```bash
clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp:504:16:
 warning: variable ā€˜i’ set but not used [-Wunused-but-set-variable=]
  504 |       unsigned i = 0;
      |                ^
```

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.

>From 347f53508282f6a564261e6f29b58a404b0fc91d Mon Sep 17 00:00:00 2001
From: Hardik Kumar <[email protected]>
Date: Sat, 25 Jul 2026 09:51:12 +0530
Subject: [PATCH] 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?

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to