================
@@ -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
----------------
Michael137 wrote:

Sorry I should've been clearer. I meant re-using the guts of `addIntAsBlock`. I 
haven't fully thought through the idea of combining all the elements into an 
APInt, but that feels a bit off. Could we extract the innards of 
`addIntAsBlock` (everything apart from allocating the `DIEBlock` and calling 
`addBlock`) into a helper called `addIntToBlock(DIEBlock&, const APInt &Val)` 
or something.

Then you loop over all the elements of the `ConstantDataSequential` and call 
`addIntToBlock`. And finally you call `addBlock`. You could put all that into 
another helper even and call it `addIntArrayAsBlock` or something.

Does that make sense?

https://github.com/llvm/llvm-project/pull/184804
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to