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

Improved nullptr tostring

This commit is contained in:
Brian Fiete 2020-08-10 06:39:31 -07:00
parent 6b67a4493d
commit 2a2b944fdd

View file

@ -666,7 +666,10 @@ BfIRValue BfIRConstHolder::CreateConst(BfConstant* fromConst, BfIRConstHolder* f
}
else if (fromConst->mTypeCode == BfTypeCode_NullPtr)
{
return CreateConstNull();
if (fromConst->mIRType)
return CreateConstNull(fromConst->mIRType);
else
return CreateConstNull();
}
else
{
@ -1217,19 +1220,13 @@ String BfIRBuilder::ToString(BfIRValue irValue)
}
else if (constant->mTypeCode == BfTypeCode_NullPtr)
{
if (constant->mInt32 == -1)
return "null";
else if (mBfIRCodeGen != NULL)
String ret = "null";
if (constant->mIRType)
{
auto llvmType = mBfIRCodeGen->GetLLVMType(constant->mInt32);
std::string outStr;
llvm::raw_string_ostream strStream(outStr);
llvmType->print(strStream);
strStream.flush();
return StrFormat("null(%s)", outStr.c_str());
ret += "\n";
ret += ToString(constant->mIRType);
}
else
return "???";
return ret;
}
else if (constant->mTypeCode == BfTypeCode_Boolean)
{
@ -1414,12 +1411,14 @@ String BfIRBuilder::ToString(BfIRType irType)
return str;
}
#endif
else if (irType.mKind == BfIRTypeData::TypeKind_TypeId)
{
return StrFormat("Type Id %d", irType.mId);
}
else
{
return "???";
}
return "Type ???";
}
}
String BfIRBuilder::ToString(BfIRFunction irFunc)