[clang] [CIR][NFC] Fix an unused variable warning (PR #135046)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 9 09:37:06 PDT 2025


https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/135046

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

>From efc3cdc2f0949ab3a3369dd0dd6da394974342ed Mon Sep 17 00:00:00 2001
From: Andy Kaylor <akaylor at nvidia.com>
Date: Wed, 9 Apr 2025 09:31:51 -0700
Subject: [PATCH] [CIR][NFC] Fix an unused variable warning

---
 clang/lib/CIR/CodeGen/CIRGenExpr.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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();



More information about the cfe-commits mailing list