1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Fixed zero-initialize array of non-aligned-size structs

This commit is contained in:
Brian Fiete 2020-07-31 06:17:47 -07:00
parent 2e656e88f3
commit b544f96bf7
2 changed files with 26 additions and 1 deletions

View file

@ -1288,6 +1288,25 @@ String BfIRBuilder::ToString(BfIRValue irValue)
BfIRValue targetConst(BfIRValueFlags_Const, ptrToIntConst->mTarget);
return ToString(targetConst) + StrFormat(" PtrToInt TypeCode:%d", ptrToIntConst->mToTypeCode);
}
else if (constant->mConstType == BfConstType_Array)
{
auto constArray = (BfConstantArray*)constant;
String str = ToString(constArray->mType);
str += "(";
for (int i = 0; i < (int)constArray->mValues.size(); i++)
{
if (i > 0)
str += ", ";
str += ToString(constArray->mValues[i]);
}
str += ");";
return str;
}
else if (constant->mConstType == BfConstType_AggZero)
{
return ToString(constant->mIRType) + " zeroinitializer";
}
else
{
BF_FATAL("Unhandled");