[clang] [CIR] Handle const evaluated variable values (PR #205512)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 24 02:21:41 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Akimasa Watanuki (Men-cotton)
<details>
<summary>Changes</summary>
Match the `VarDecl::evaluateValue()` contract updated by #<!-- -->205033 in CIR constant emission.
---
Full diff: https://github.com/llvm/llvm-project/pull/205512.diff
1 Files Affected:
- (modified) clang/lib/CIR/CodeGen/CIRGenExprConstant.cpp (+1-1)
``````````diff
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 {};
``````````
</details>
https://github.com/llvm/llvm-project/pull/205512
More information about the cfe-commits
mailing list