-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[clang] Remove unused local variables (NFC) #138468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[clang] Remove unused local variables (NFC) #138468
Conversation
@llvm/pr-subscribers-backend-powerpc @llvm/pr-subscribers-clang Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/138468.diff 7 Files Affected:
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);
|
@llvm/pr-subscribers-clang-static-analyzer-1 Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/138468.diff 7 Files Affected:
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);
|
LLVM Buildbot has detected a new failure on builder 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
|
No description provided.