[clang] [CIR] Handle const evaluated variable values (PR #205512)
Akimasa Watanuki via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 24 02:21:01 PDT 2026
https://github.com/Men-cotton created https://github.com/llvm/llvm-project/pull/205512
Match the `VarDecl::evaluateValue()` contract updated by #205033 in CIR constant emission.
>From a2167b21cbf346b1bd1ad63ebef34c9a1ed655c3 Mon Sep 17 00:00:00 2001
From: mencotton <mencotton0410 at gmail.com>
Date: Wed, 24 Jun 2026 17:42:41 +0900
Subject: [PATCH] [CIR] Handle const evaluated variable values
Match the `VarDecl::evaluateValue()` contract updated by #205033 in CIR constant emission.
---
clang/lib/CIR/CodeGen/CIRGenExprConstant.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/lib/CIR/CodeGen/CIRGenExprConstant.cpp b/clang/lib/CIR/CodeGen/CIRGenExprConstant.cpp
index 6c64d7571795a..c29b66ac2f8bc 100644
--- a/clang/lib/CIR/CodeGen/CIRGenExprConstant.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenExprConstant.cpp
@@ -1725,7 +1725,7 @@ mlir::Attribute ConstantEmitter::tryEmitPrivateForVarInit(const VarDecl &d) {
// Try to emit the initializer. Note that this can allow some things that
// are not allowed by tryEmitPrivateForMemory alone.
- if (APValue *value = d.evaluateValue())
+ if (const APValue *value = d.evaluateValue())
return tryEmitPrivateForMemory(*value, destType);
return {};
More information about the cfe-commits
mailing list