Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

No description provided.

@llvmbot llvmbot added clang Clang issues not falling into any other category backend:PowerPC clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:static analyzer labels May 4, 2025
@llvmbot
Copy link
Member

llvmbot commented May 4, 2025

@llvm/pr-subscribers-backend-powerpc

@llvm/pr-subscribers-clang

Author: Kazu Hirata (kazutakahirata)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/138468.diff

7 Files Affected:

  • (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConstraintManager.h (-2)
  • (modified) clang/lib/Sema/SemaPPC.cpp (-1)
  • (modified) clang/lib/Sema/SemaTemplateDeduction.cpp (-2)
  • (modified) clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp (-2)
  • (modified) clang/lib/StaticAnalyzer/Core/BugReporter.cpp (-2)
  • (modified) clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp (+1-1)
  • (modified) clang/unittests/Tooling/CompilationDatabaseTest.cpp (-1)
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);

@llvmbot
Copy link
Member

llvmbot commented May 4, 2025

@llvm/pr-subscribers-clang-static-analyzer-1

Author: Kazu Hirata (kazutakahirata)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/138468.diff

7 Files Affected:

  • (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConstraintManager.h (-2)
  • (modified) clang/lib/Sema/SemaPPC.cpp (-1)
  • (modified) clang/lib/Sema/SemaTemplateDeduction.cpp (-2)
  • (modified) clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp (-2)
  • (modified) clang/lib/StaticAnalyzer/Core/BugReporter.cpp (-2)
  • (modified) clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp (+1-1)
  • (modified) clang/unittests/Tooling/CompilationDatabaseTest.cpp (-1)
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);

@kazutakahirata kazutakahirata merged commit 1812a43 into llvm:main May 4, 2025
16 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_tidy_bugprone-unused-local-non-trivial-variable_clang branch May 4, 2025 21:14
@llvm-ci
Copy link
Collaborator

llvm-ci commented May 4, 2025

LLVM Buildbot has detected a new failure on builder openmp-clang-x86_64-linux-debian running on gribozavr4 while building clang at step 6 "test-openmp".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/6/builds/8904

Here is the relevant piece of the build log for the reference
Step 6 (test-openmp) failure: test (failure)
******************** TEST 'libomp :: tasking/issue-94260-2.c' FAILED ********************
Exit Code: -11

Command Output (stdout):
--
# RUN: at line 1
/b/1/openmp-clang-x86_64-linux-debian/llvm.build/./bin/clang -fopenmp   -I /b/1/openmp-clang-x86_64-linux-debian/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -I /b/1/openmp-clang-x86_64-linux-debian/llvm.src/openmp/runtime/test -L /b/1/openmp-clang-x86_64-linux-debian/llvm.build/runtimes/runtimes-bins/openmp/runtime/src  -fno-omit-frame-pointer -I /b/1/openmp-clang-x86_64-linux-debian/llvm.src/openmp/runtime/test/ompt /b/1/openmp-clang-x86_64-linux-debian/llvm.src/openmp/runtime/test/tasking/issue-94260-2.c -o /b/1/openmp-clang-x86_64-linux-debian/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp -lm -latomic && /b/1/openmp-clang-x86_64-linux-debian/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp
# executed command: /b/1/openmp-clang-x86_64-linux-debian/llvm.build/./bin/clang -fopenmp -I /b/1/openmp-clang-x86_64-linux-debian/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -I /b/1/openmp-clang-x86_64-linux-debian/llvm.src/openmp/runtime/test -L /b/1/openmp-clang-x86_64-linux-debian/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -fno-omit-frame-pointer -I /b/1/openmp-clang-x86_64-linux-debian/llvm.src/openmp/runtime/test/ompt /b/1/openmp-clang-x86_64-linux-debian/llvm.src/openmp/runtime/test/tasking/issue-94260-2.c -o /b/1/openmp-clang-x86_64-linux-debian/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp -lm -latomic
# executed command: /b/1/openmp-clang-x86_64-linux-debian/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp
# note: command had no output on stdout or stderr
# error: command failed with exit status: -11

--

********************


IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
GeorgeARM pushed a commit to GeorgeARM/llvm-project that referenced this pull request May 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend:PowerPC clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:static analyzer clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants