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

via cfe-commits cfe-commits at lists.llvm.org
Sat May 3 10:07:06 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clangir

Author: Amr Hesham (AmrDeveloper)

<details>
<summary>Changes</summary>

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

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


1 Files Affected:

- (modified) clang/lib/CIR/CodeGen/CIRGenExprConstant.cpp (+2-1) 


``````````diff
diff --git a/clang/lib/CIR/CodeGen/CIRGenExprConstant.cpp b/clang/lib/CIR/CodeGen/CIRGenExprConstant.cpp
index ab1ea07bbf5ef..2d8550fad454c 100644
--- a/clang/lib/CIR/CodeGen/CIRGenExprConstant.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenExprConstant.cpp
@@ -90,9 +90,10 @@ class ConstExprEmitter
   }
 
   mlir::Attribute VisitCastExpr(CastExpr *e, QualType destType) {
-    if (const auto *ece = dyn_cast<ExplicitCastExpr>(e))
+    if (isa<ExplicitCastExpr>(e))
       cgm.errorNYI(e->getBeginLoc(),
                    "ConstExprEmitter::VisitCastExpr explicit cast");
+
     Expr *subExpr = e->getSubExpr();
 
     switch (e->getCastKind()) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/138415


More information about the cfe-commits mailing list