https://github.com/kazutakahirata created 
https://github.com/llvm/llvm-project/pull/138468

None

>From 89189fd5a12716b35019271a7473887867b2c3e1 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <k...@google.com>
Date: Sun, 4 May 2025 13:03:48 -0700
Subject: [PATCH] [clang] Remove unused local variables (NFC)

---
 .../StaticAnalyzer/Core/PathSensitive/SMTConstraintManager.h    | 2 --
 clang/lib/Sema/SemaPPC.cpp                                      | 1 -
 clang/lib/Sema/SemaTemplateDeduction.cpp                        | 2 --
 clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp  | 2 --
 clang/lib/StaticAnalyzer/Core/BugReporter.cpp                   | 2 --
 clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp             | 2 +-
 clang/unittests/Tooling/CompilationDatabaseTest.cpp             | 1 -
 7 files changed, 1 insertion(+), 11 deletions(-)

diff --git 
a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConstraintManager.h 
b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConstraintManager.h
index e084a13995306..d4052ef90de6e 100644
--- 
a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConstraintManager.h
+++ 
b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConstraintManager.h
@@ -324,8 +324,6 @@ class SMTConstraintManager : public 
clang::ento::SimpleConstraintManager {
 
     // Construct the logical AND of all the constraints
     if (I != IE) {
-      std::vector<llvm::SMTExprRef> ASTs;
-
       llvm::SMTExprRef Constraint = I++->second;
       while (I != IE) {
         Constraint = Solver->mkAnd(Constraint, I++->second);
diff --git a/clang/lib/Sema/SemaPPC.cpp b/clang/lib/Sema/SemaPPC.cpp
index b6802d6890ed1..9b4d82745f881 100644
--- a/clang/lib/Sema/SemaPPC.cpp
+++ b/clang/lib/Sema/SemaPPC.cpp
@@ -98,7 +98,6 @@ bool SemaPPC::CheckPPCBuiltinFunctionCall(const TargetInfo 
&TI,
                                           CallExpr *TheCall) {
   ASTContext &Context = getASTContext();
   bool IsTarget64Bit = TI.getTypeWidth(TI.getIntPtrType()) == 64;
-  llvm::APSInt Result;
 
   if (isPPC_64Builtin(BuiltinID) && !IsTarget64Bit)
     return Diag(TheCall->getBeginLoc(), diag::err_64_bit_builtin_32_bit_tgt)
diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp 
b/clang/lib/Sema/SemaTemplateDeduction.cpp
index 0ecdbb3ffb89f..c9de36383d334 100644
--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -6605,8 +6605,6 @@ bool 
Sema::isTemplateTemplateParameterAtLeastAsSpecializedAs(
     llvm_unreachable("Unexpected Result");
   }
 
-  SmallVector<TemplateArgument, 4> DeducedArgs(Deduced.begin(), Deduced.end());
-
   TemplateDeductionResult TDK;
   runWithSufficientStackSpace(Info.getLocation(), [&] {
     TDK = ::FinishTemplateArgumentDeduction(
diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp 
b/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp
index 0f0184c472f36..4ddd11495f534 100644
--- a/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp
@@ -370,8 +370,6 @@ std::optional<bool> isUnsafePtr(const QualType T, bool 
IsArcEnabled) {
 std::optional<bool> isGetterOfSafePtr(const CXXMethodDecl *M) {
   assert(M);
 
-  std::optional<RetainTypeChecker> RTC;
-
   if (isa<CXXMethodDecl>(M)) {
     const CXXRecordDecl *calleeMethodsClass = M->getParent();
     auto className = safeGetName(calleeMethodsClass);
diff --git a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp 
b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
index f8db8d0bc8343..28b96f2717210 100644
--- a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
+++ b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
@@ -3377,8 +3377,6 @@ 
PathSensitiveBugReporter::generateDiagnosticForConsumerMap(
     BugReport *exampleReport,
     ArrayRef<std::unique_ptr<PathDiagnosticConsumer>> consumers,
     ArrayRef<BugReport *> bugReports) {
-  std::vector<BasicBugReport *> BasicBugReports;
-  std::vector<PathSensitiveBugReport *> PathSensitiveBugReports;
   if (isa<BasicBugReport>(exampleReport))
     return BugReporter::generateDiagnosticForConsumerMap(exampleReport,
                                                          consumers, 
bugReports);
diff --git a/clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp 
b/clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
index 95d9df4100bfa..84a9c43d3572e 100644
--- a/clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
+++ b/clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
@@ -270,7 +270,7 @@ static bool isWithinConstantOverflowBounds(llvm::APSInt I) {
   assert(!AT.isUnsigned() &&
          "This only works with signed integers!");
 
-  llvm::APSInt Max = AT.getMaxValue() / AT.getValue(4), Min = -Max;
+  llvm::APSInt Max = AT.getMaxValue() / AT.getValue(4);
   return (I <= Max) && (I >= -Max);
 }
 
diff --git a/clang/unittests/Tooling/CompilationDatabaseTest.cpp 
b/clang/unittests/Tooling/CompilationDatabaseTest.cpp
index 2032b13726c45..c1febaf40bf19 100644
--- a/clang/unittests/Tooling/CompilationDatabaseTest.cpp
+++ b/clang/unittests/Tooling/CompilationDatabaseTest.cpp
@@ -703,7 +703,6 @@ TEST(ParseFixedCompilationDatabase, HandlesArgv0) {
     Database->getCompileCommands("source");
   ASSERT_EQ(1ul, Result.size());
   ASSERT_EQ(".", Result[0].Directory);
-  std::vector<std::string> Expected;
   ASSERT_THAT(Result[0].CommandLine,
               ElementsAre(EndsWith("clang-tool"), "source"));
   EXPECT_EQ(2, Argc);

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to