mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-14 14:24:10 +02:00
Improved nullptr tostring
This commit is contained in:
parent
6b67a4493d
commit
2a2b944fdd
1 changed files with 15 additions and 16 deletions
|
@ -666,7 +666,10 @@ BfIRValue BfIRConstHolder::CreateConst(BfConstant* fromConst, BfIRConstHolder* f
|
||||||
}
|
}
|
||||||
else if (fromConst->mTypeCode == BfTypeCode_NullPtr)
|
else if (fromConst->mTypeCode == BfTypeCode_NullPtr)
|
||||||
{
|
{
|
||||||
return CreateConstNull();
|
if (fromConst->mIRType)
|
||||||
|
return CreateConstNull(fromConst->mIRType);
|
||||||
|
else
|
||||||
|
return CreateConstNull();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1217,19 +1220,13 @@ String BfIRBuilder::ToString(BfIRValue irValue)
|
||||||
}
|
}
|
||||||
else if (constant->mTypeCode == BfTypeCode_NullPtr)
|
else if (constant->mTypeCode == BfTypeCode_NullPtr)
|
||||||
{
|
{
|
||||||
if (constant->mInt32 == -1)
|
String ret = "null";
|
||||||
return "null";
|
if (constant->mIRType)
|
||||||
else if (mBfIRCodeGen != NULL)
|
|
||||||
{
|
{
|
||||||
auto llvmType = mBfIRCodeGen->GetLLVMType(constant->mInt32);
|
ret += "\n";
|
||||||
std::string outStr;
|
ret += ToString(constant->mIRType);
|
||||||
llvm::raw_string_ostream strStream(outStr);
|
|
||||||
llvmType->print(strStream);
|
|
||||||
strStream.flush();
|
|
||||||
return StrFormat("null(%s)", outStr.c_str());
|
|
||||||
}
|
}
|
||||||
else
|
return ret;
|
||||||
return "???";
|
|
||||||
}
|
}
|
||||||
else if (constant->mTypeCode == BfTypeCode_Boolean)
|
else if (constant->mTypeCode == BfTypeCode_Boolean)
|
||||||
{
|
{
|
||||||
|
@ -1414,12 +1411,14 @@ String BfIRBuilder::ToString(BfIRType irType)
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
else if (irType.mKind == BfIRTypeData::TypeKind_TypeId)
|
||||||
|
{
|
||||||
|
return StrFormat("Type Id %d", irType.mId);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return "???";
|
return "Type ???";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String BfIRBuilder::ToString(BfIRFunction irFunc)
|
String BfIRBuilder::ToString(BfIRFunction irFunc)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue