mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Fixed enum with extension with ToString override
This commit is contained in:
parent
38d2eff3f6
commit
f09a9b41f1
6 changed files with 25 additions and 14 deletions
|
@ -2433,6 +2433,12 @@ void BeIRCodeGen::HandleNextCmd()
|
||||||
func->mBlocks.Clear();
|
func->mBlocks.Clear();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case BfIRCmd_Func_SafeRename:
|
||||||
|
{
|
||||||
|
CMD_PARAM(BeFunction*, func);
|
||||||
|
func->mName += StrFormat("__RENAME%d", curId);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case BfIRCmd_Func_SetLinkage:
|
case BfIRCmd_Func_SetLinkage:
|
||||||
{
|
{
|
||||||
CMD_PARAM(BeFunction*, func);
|
CMD_PARAM(BeFunction*, func);
|
||||||
|
|
|
@ -4466,7 +4466,7 @@ void BfCompiler::ProcessAutocompleteTempType()
|
||||||
{
|
{
|
||||||
BfLogSysM("Autocomplete removing IRFunction %d\n", methodInstance->mIRFunction.mId);
|
BfLogSysM("Autocomplete removing IRFunction %d\n", methodInstance->mIRFunction.mId);
|
||||||
module->mBfIRBuilder->Func_DeleteBody(methodInstance->mIRFunction);
|
module->mBfIRBuilder->Func_DeleteBody(methodInstance->mIRFunction);
|
||||||
module->mBfIRBuilder->Func_EraseFromParent(methodInstance->mIRFunction);
|
module->mBfIRBuilder->Func_SafeRename(methodInstance->mIRFunction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4773,19 +4773,18 @@ void BfIRBuilder::Func_DeleteBody(BfIRFunction func)
|
||||||
NEW_CMD_INSERTED;
|
NEW_CMD_INSERTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BfIRBuilder::Func_EraseFromParent(BfIRFunction func)
|
void BfIRBuilder::Func_SafeRename(BfIRFunction func)
|
||||||
{
|
{
|
||||||
// Refuse to erase from parent
|
WriteCmd(BfIRCmd_Func_SafeRename, func);
|
||||||
/*WriteCmd(BfIRCmd_Func_EraseFromParent, func);
|
|
||||||
|
|
||||||
// We don't actually remove it from the named map. It doesn't matter for us.
|
// We don't actually remove it from the named map. It doesn't matter for us.
|
||||||
|
|
||||||
{
|
// {
|
||||||
auto llvmFunc = llvm::dyn_cast<llvm::Function>(func.mLLVMValue);
|
// auto llvmFunc = llvm::dyn_cast<llvm::Function>(func.mLLVMValue);
|
||||||
llvmFunc->eraseFromParent();
|
// llvmFunc->eraseFromParent();
|
||||||
}
|
// }
|
||||||
|
|
||||||
NEW_CMD_INSERTED;*/
|
NEW_CMD_INSERTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BfIRBuilder::Func_SetLinkage(BfIRFunction func, BfIRLinkageType linkage)
|
void BfIRBuilder::Func_SetLinkage(BfIRFunction func, BfIRLinkageType linkage)
|
||||||
|
|
|
@ -278,7 +278,7 @@ enum BfIRCmd : uint8
|
||||||
BfIRCmd_Func_AddAttribute1,
|
BfIRCmd_Func_AddAttribute1,
|
||||||
BfIRCmd_Func_SetParamName,
|
BfIRCmd_Func_SetParamName,
|
||||||
BfIRCmd_Func_DeleteBody,
|
BfIRCmd_Func_DeleteBody,
|
||||||
BfIRCmd_Func_EraseFromParent,
|
BfIRCmd_Func_SafeRename,
|
||||||
BfIRCmd_Func_SetLinkage,
|
BfIRCmd_Func_SetLinkage,
|
||||||
|
|
||||||
BfIRCmd_SaveDebugLocation,
|
BfIRCmd_SaveDebugLocation,
|
||||||
|
@ -1223,7 +1223,7 @@ public:
|
||||||
void Func_AddAttribute(BfIRFunction func, int argIdx, BfIRAttribute attr, int arg);
|
void Func_AddAttribute(BfIRFunction func, int argIdx, BfIRAttribute attr, int arg);
|
||||||
void Func_SetParamName(BfIRFunction func, int argIdx, const StringImpl& name);
|
void Func_SetParamName(BfIRFunction func, int argIdx, const StringImpl& name);
|
||||||
void Func_DeleteBody(BfIRFunction func);
|
void Func_DeleteBody(BfIRFunction func);
|
||||||
void Func_EraseFromParent(BfIRFunction func);
|
void Func_SafeRename(BfIRFunction func);
|
||||||
void Func_SetLinkage(BfIRFunction func, BfIRLinkageType linkage);
|
void Func_SetLinkage(BfIRFunction func, BfIRLinkageType linkage);
|
||||||
|
|
||||||
void SaveDebugLocation();
|
void SaveDebugLocation();
|
||||||
|
|
|
@ -3520,6 +3520,12 @@ void BfIRCodeGen::HandleNextCmd()
|
||||||
((llvm::Function*)func)->deleteBody();
|
((llvm::Function*)func)->deleteBody();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case BfIRCmd_Func_SafeRename:
|
||||||
|
{
|
||||||
|
CMD_PARAM(llvm::Function*, func);
|
||||||
|
func->setName((Beefy::String(func->getName()) + StrFormat("__RENAME%d", curId)).c_str());
|
||||||
|
}
|
||||||
|
break;
|
||||||
case BfIRCmd_Func_SetLinkage:
|
case BfIRCmd_Func_SetLinkage:
|
||||||
{
|
{
|
||||||
CMD_PARAM(llvm::Function*, func);
|
CMD_PARAM(llvm::Function*, func);
|
||||||
|
|
|
@ -20225,7 +20225,7 @@ void BfModule::SetupIRFunction(BfMethodInstance* methodInstance, StringImpl& man
|
||||||
if ((methodDef->mIsOverride) && (mCurTypeInstance->mTypeDef->mIsCombinedPartial))
|
if ((methodDef->mIsOverride) && (mCurTypeInstance->mTypeDef->mIsCombinedPartial))
|
||||||
{
|
{
|
||||||
BfLogSysM("Function collision from inner override erased prevFunc %p: %d\n", methodInstance, prevFunc.mId);
|
BfLogSysM("Function collision from inner override erased prevFunc %p: %d\n", methodInstance, prevFunc.mId);
|
||||||
mBfIRBuilder->Func_EraseFromParent(prevFunc);
|
mBfIRBuilder->Func_SafeRename(prevFunc);
|
||||||
}
|
}
|
||||||
else if (methodDef->mIsExtern)
|
else if (methodDef->mIsExtern)
|
||||||
{
|
{
|
||||||
|
@ -20247,7 +20247,7 @@ void BfModule::SetupIRFunction(BfMethodInstance* methodInstance, StringImpl& man
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BfLogSysM("Function collision erased prevFunc %p: %d\n", methodInstance, prevFunc.mId);
|
BfLogSysM("Function collision erased prevFunc %p: %d\n", methodInstance, prevFunc.mId);
|
||||||
mBfIRBuilder->Func_EraseFromParent(prevFunc);
|
mBfIRBuilder->Func_SafeRename(prevFunc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue