Skip to content

[NFC] [clang] fix unused variable warning #126796

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

Merged
merged 1 commit into from
Feb 11, 2025

Conversation

fmayer
Copy link
Contributor

@fmayer fmayer commented Feb 11, 2025

No description provided.

Created using spr 1.3.4
@fmayer fmayer added the skip-precommit-approval PR for CI feedback, not intended for review label Feb 11, 2025
@fmayer fmayer marked this pull request as ready for review February 11, 2025 21:22
@fmayer fmayer merged commit 5c7071e into main Feb 11, 2025
9 of 11 checks passed
@fmayer fmayer deleted the users/fmayer/spr/nfc-clang-fix-unused-variable-warning branch February 11, 2025 21:22
@fmayer fmayer requested a review from rniwa February 11, 2025 21:22
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:static analyzer labels Feb 11, 2025
@llvmbot
Copy link
Member

llvmbot commented Feb 11, 2025

@llvm/pr-subscribers-clang

Author: Florian Mayer (fmayer)

Changes

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

1 Files Affected:

  • (modified) clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp (+1-1)
diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp
index 6452dedb8c391..1411bf1d1c237 100644
--- a/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp
@@ -156,7 +156,7 @@ bool isConstOwnerPtrMemberExpr(const clang::Expr *E) {
       auto Name = safeGetName(Callee);
       if (Name == "get" || Name == "ptr")
         E = MCE->getImplicitObjectArgument();
-      if (auto *CD = dyn_cast<CXXConversionDecl>(Callee))
+      if (dyn_cast<CXXConversionDecl>(Callee))
         E = MCE->getImplicitObjectArgument();
     }
   } else if (auto *OCE = dyn_cast<CXXOperatorCallExpr>(E)) {

@llvmbot
Copy link
Member

llvmbot commented Feb 11, 2025

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

Author: Florian Mayer (fmayer)

Changes

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

1 Files Affected:

  • (modified) clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp (+1-1)
diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp
index 6452dedb8c391..1411bf1d1c237 100644
--- a/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp
@@ -156,7 +156,7 @@ bool isConstOwnerPtrMemberExpr(const clang::Expr *E) {
       auto Name = safeGetName(Callee);
       if (Name == "get" || Name == "ptr")
         E = MCE->getImplicitObjectArgument();
-      if (auto *CD = dyn_cast<CXXConversionDecl>(Callee))
+      if (dyn_cast<CXXConversionDecl>(Callee))
         E = MCE->getImplicitObjectArgument();
     }
   } else if (auto *OCE = dyn_cast<CXXOperatorCallExpr>(E)) {

Copy link
Contributor

@steakhal steakhal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think isa should be preferred if the result of dyncast is not used.
Same applied to the surrounding ifs too.

@steakhal
Copy link
Contributor

Ah, so this one is already merged. Then nvm. It's not worth a followup.

Copy link
Contributor

@rniwa rniwa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh oops, thank you for the fix. It's odd that the checks didn't catch this before the merge...

@fmayer
Copy link
Contributor Author

fmayer commented Feb 11, 2025

I think isa should be preferred if the result of dyncast is not used. Same applied to the surrounding ifs too.

ad905f1

Icohedron pushed a commit to Icohedron/llvm-project that referenced this pull request Feb 11, 2025

Verified

This commit was signed with the committer’s verified signature.
Icohedron Deric C.
rniwa pushed a commit to rniwa/llvm-project that referenced this pull request Feb 12, 2025
flovent pushed a commit to flovent/llvm-project that referenced this pull request Feb 13, 2025
joaosaffran pushed a commit to joaosaffran/llvm-project that referenced this pull request Feb 14, 2025
sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:static analyzer clang Clang issues not falling into any other category skip-precommit-approval PR for CI feedback, not intended for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants