[clang] 2eeb3e1 - [NFC][CIR] Fix unused variable warning (#174246)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 4 03:58:06 PST 2026
Author: Thibault Monnier
Date: 2026-01-04T12:58:01+01:00
New Revision: 2eeb3e10656f4b236c252e6135261f95cf69ce2e
URL: https://github.com/llvm/llvm-project/commit/2eeb3e10656f4b236c252e6135261f95cf69ce2e
DIFF: https://github.com/llvm/llvm-project/commit/2eeb3e10656f4b236c252e6135261f95cf69ce2e.diff
LOG: [NFC][CIR] Fix unused variable warning (#174246)
This fixes the clang warning when compiling with CIR enabled and
assertions ignored:
```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)) {
| ^
```
Added:
Modified:
clang/lib/CIR/CodeGen/CIRGenTypes.cpp
Removed:
################################################################################
diff --git a/clang/lib/CIR/CodeGen/CIRGenTypes.cpp b/clang/lib/CIR/CodeGen/CIRGenTypes.cpp
index 5264357448271..cddc849180971 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 ([[maybe_unused]] const auto *ed = dyn_cast<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
More information about the cfe-commits
mailing list