1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

Fixed erroneous char ptr const generation

This commit is contained in:
Brian Fiete 2021-12-14 09:53:43 -05:00
parent 31af480c92
commit e871bd6ace

View file

@ -2971,9 +2971,9 @@ void BfIRBuilder::CreateDbgTypeDefinition(BfType* type)
}
bool isPayloadEnum = (typeInstance->IsEnum()) && (!typeInstance->IsTypedPrimitive());
for (auto& fieldInstanceRef : typeInstance->mFieldInstances)
for (int fieldIdx = 0; fieldIdx < typeInstance->mFieldInstances.mSize; fieldIdx++)
{
auto fieldInstance = &fieldInstanceRef;
auto fieldInstance = &typeInstance->mFieldInstances[fieldIdx];
if (!fieldInstance->mFieldIncluded)
continue;
auto fieldDef = fieldInstance->GetFieldDef();
@ -3092,17 +3092,14 @@ void BfIRBuilder::CreateDbgTypeDefinition(BfType* type)
staticValue = ConstToMemory(staticValue);
wasMadeAddr = true;
}
else if (resolvedFieldType->IsPointer())
{
int stringId = constant->mInt32;
const StringImpl& str = mModule->mContext->mStringObjectIdMap[stringId].mString;
staticValue = mModule->GetStringCharPtr(str);
}
else if (constant->mTypeCode == BfTypeCode_StringId)
{
int stringId = constant->mInt32;
const StringImpl& str = mModule->mContext->mStringObjectIdMap[stringId].mString;
staticValue = mModule->GetStringObjectValue(str);
if (resolvedFieldType->IsPointer())
staticValue = mModule->GetStringCharPtr(str);
else
staticValue = mModule->GetStringObjectValue(str);
}
else
{