[clang] [llvm] [DebugInfo] Fix endianness in DW_AT_const_value for constexpr arrays (PR #184804)

Shivam Kunwar via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 6 06:32:18 PST 2026


================
@@ -2036,8 +2037,21 @@ DIE *DwarfUnit::getOrCreateStaticMemberDIE(const DIDerivedType *DT) {
 
   if (const ConstantInt *CI = dyn_cast_or_null<ConstantInt>(DT->getConstant()))
     addConstantValue(StaticMemberDIE, CI, Ty);
-  if (const ConstantFP *CFP = dyn_cast_or_null<ConstantFP>(DT->getConstant()))
+  else if (const ConstantFP *CFP =
+               dyn_cast_or_null<ConstantFP>(DT->getConstant()))
     addConstantFPValue(StaticMemberDIE, CFP);
+  else if (auto *CDS =
+               dyn_cast_or_null<ConstantDataSequential>(DT->getConstant())) {
+    // Concatenate all array elements into a single APInt and emit using
----------------
phyBrackets wrote:

Makes sense, sorry I missed that. Extracted the byte emission loop into `addIntToBlock(DIEBlock&, const APInt&)` and refactored` addIntAsBlock` to use it. And also added `computeSize` before `BestForm` in `addIntAsBlock` to fix the assertion on blocks >255 bytes.

https://github.com/llvm/llvm-project/pull/184804


More information about the cfe-commits mailing list