mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Fixed const string bitcast failure
This commit is contained in:
parent
03987ba8f5
commit
3864a8896b
3 changed files with 32 additions and 2 deletions
|
@ -1766,6 +1766,29 @@ BfIRValue BfModule::CreateStringObjectValue(const StringImpl& str, int stringId,
|
|||
return stringValLiteral;
|
||||
}
|
||||
|
||||
bool BfModule::HasStringId(BfIRValue constantStr, BfIRConstHolder* constHolder)
|
||||
{
|
||||
if (constHolder == NULL)
|
||||
constHolder = mBfIRBuilder;
|
||||
|
||||
auto constant = constHolder->GetConstant(constantStr);
|
||||
if (constant == NULL)
|
||||
return false;
|
||||
|
||||
while (constant->mConstType == BfConstType_BitCast)
|
||||
{
|
||||
auto constBitCast = (BfConstantBitCast*)constant;
|
||||
constant = constHolder->GetConstantById(constBitCast->mTarget);
|
||||
}
|
||||
|
||||
if (constant->mTypeCode == BfTypeCode_StringId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int BfModule::GetStringPoolIdx(BfIRValue constantStr, BfIRConstHolder* constHolder)
|
||||
{
|
||||
if (constHolder == NULL)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue