Skip to content

[CIR][NFC] Fix an unused variable warning #135046

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
Apr 9, 2025
Merged

Conversation

andykaylor
Copy link
Contributor

This fixes a warning where a variable assigned in a 'if' statement wasn't referenced again.

@andykaylor andykaylor requested a review from erichkeane April 9, 2025 16:36
@llvmbot llvmbot added clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project labels Apr 9, 2025
@llvmbot
Copy link
Member

llvmbot commented Apr 9, 2025

@llvm/pr-subscribers-clangir

@llvm/pr-subscribers-clang

Author: Andy Kaylor (andykaylor)

Changes

This fixes a warning where a variable assigned in a 'if' statement wasn't referenced again.


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

1 Files Affected:

  • (modified) clang/lib/CIR/CodeGen/CIRGenExpr.cpp (+1-1)
diff --git a/clang/lib/CIR/CodeGen/CIRGenExpr.cpp b/clang/lib/CIR/CodeGen/CIRGenExpr.cpp
index fe3f2f5de249c..0a7b3a837ed39 100644
--- a/clang/lib/CIR/CodeGen/CIRGenExpr.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenExpr.cpp
@@ -35,7 +35,7 @@ Address CIRGenFunction::emitPointerWithAlignment(const Expr *expr) {
 
   // Casts:
   if (auto const *ce = dyn_cast<CastExpr>(expr)) {
-    if (auto const *ece = dyn_cast<ExplicitCastExpr>(ce)) {
+    if (isa<ExplicitCastExpr>(ce)) {
       cgm.errorNYI(expr->getSourceRange(),
                    "emitPointerWithAlignment: explicit cast");
       return Address::invalid();

Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

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

LGTM. Btw I started seeing tons of these in the incubator since my latest macOS update too, will do a round of cleanup there as well

@andykaylor andykaylor merged commit f75dce4 into llvm:main Apr 9, 2025
14 checks passed
AllinLeeYL pushed a commit to AllinLeeYL/llvm-project that referenced this pull request Apr 10, 2025
This fixes a warning where a variable assigned in a 'if' statement
wasn't referenced again.
@andykaylor andykaylor deleted the cir-unused branch April 10, 2025 21:16
var-const pushed a commit to ldionne/llvm-project that referenced this pull request Apr 17, 2025
This fixes a warning where a variable assigned in a 'if' statement
wasn't referenced again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants