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

via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 2 14:08:51 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clangir

Author: Thibault Monnier (Thibault-Monnier)

<details>
<summary>Changes</summary>

This fixes the clang warning when compiling with CIR enabled:
```cpp
llvm-project/clang/lib/CIR/CodeGen/CIRGenTypes.cpp:713:19: warning: variable 'ed' set but not used [-Wunused-but-set-variable]
  713 |   if (const auto *ed = dyn_cast<EnumDecl>(td)) {
      |                   ^
```

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


1 Files Affected:

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


``````````diff
diff --git a/clang/lib/CIR/CodeGen/CIRGenTypes.cpp b/clang/lib/CIR/CodeGen/CIRGenTypes.cpp
index 5264357448271..1321246d5179a 100644
--- a/clang/lib/CIR/CodeGen/CIRGenTypes.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenTypes.cpp
@@ -710,7 +710,7 @@ void CIRGenTypes::updateCompletedType(const TagDecl *td) {
   // If this is an enum being completed, then we flush all non-struct types
   // from the cache. This allows function types and other things that may be
   // derived from the enum to be recomputed.
-  if (const auto *ed = dyn_cast<EnumDecl>(td)) {
+  if (isa<EnumDecl>(td)) {
     // Classic codegen clears the type cache if it contains an entry for this
     // enum type that doesn't use i32 as the underlying type, but I can't find
     // a test case that meets that condition. C++ doesn't allow forward

``````````

</details>


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


More information about the cfe-commits mailing list