[clang] [llvm] [DebugInfo] Emit DW_AT_const_value for constexpr array static members (PR #182442)
Vladislav Dzhidzhoev via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 20 06:22:02 PST 2026
================
@@ -2097,6 +2092,53 @@ CGDebugInfo::CreateRecordStaticField(const VarDecl *Var, llvm::DIType *RecordTy,
C = llvm::ConstantInt::get(CGM.getLLVMContext(), Value->getInt());
if (Value->isFloat())
C = llvm::ConstantFP::get(CGM.getLLVMContext(), Value->getFloat());
+ if (Value->isArray()) {
+ // Handle constexpr array constants for debug info
+ // We handle arrays of integer types (char, short, int, long),
+ // which covers the most common and useful cases.
+ if (const auto *ArrayTy =
+ CGM.getContext().getAsArrayType(Var->getType())) {
+ QualType ElemQTy = ArrayTy->getElementType();
----------------
dzhidzhoev wrote:
Should we move the body of this if branch (or the if branch above) into a lambda, and call it from here? So that we can use early-exits instead of having "Status &&" or "&& Status" in three places.
https://github.com/llvm/llvm-project/pull/182442
More information about the cfe-commits
mailing list