[clang] 86e2f0f - [CIR] Handle const evaluated variable values (#205512)

via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 24 03:02:36 PDT 2026


Author: Akimasa Watanuki
Date: 2026-06-24T19:02:31+09:00
New Revision: 86e2f0f502066a2624981d6272b0dd727edc78b7

URL: https://github.com/llvm/llvm-project/commit/86e2f0f502066a2624981d6272b0dd727edc78b7
DIFF: https://github.com/llvm/llvm-project/commit/86e2f0f502066a2624981d6272b0dd727edc78b7.diff

LOG: [CIR] Handle const evaluated variable values (#205512)

Match the `VarDecl::evaluateValue()` contract updated by #205033 in CIR
constant emission.

Added: 
    

Modified: 
    clang/lib/CIR/CodeGen/CIRGenExprConstant.cpp

Removed: 
    


################################################################################
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