[clang] bcd5798 - [clang][NFC]Remove unused variable (#211983)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 24 22:21:12 PDT 2026


Author: Hardik Kumar
Date: 2026-07-25T10:51:07+05:30
New Revision: bcd5798f6d5866fac01b101e6e3666ff61659515

URL: https://github.com/llvm/llvm-project/commit/bcd5798f6d5866fac01b101e6e3666ff61659515
DIFF: https://github.com/llvm/llvm-project/commit/bcd5798f6d5866fac01b101e6e3666ff61659515.diff

LOG: [clang][NFC]Remove unused variable (#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.

Added: 
    

Modified: 
    clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
index 0eee742fa0da3..0b7c8f5f69a38 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?


        


More information about the cfe-commits mailing list