mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-11 12:54:15 +02:00
Mangle fixes
This commit is contained in:
parent
166f997b0a
commit
0bed50cf7c
2 changed files with 37 additions and 15 deletions
|
@ -914,13 +914,16 @@ String BfGNUMangler::Mangle(BfMethodInstance* methodInst)
|
||||||
prefixLen = true;
|
prefixLen = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (methodDef->mCheckedKind == BfCheckedKind_Checked)
|
if (!mangleContext.mCPPMangle)
|
||||||
name += "`CHK";
|
{
|
||||||
else if (methodDef->mCheckedKind == BfCheckedKind_Unchecked)
|
if (methodDef->mCheckedKind == BfCheckedKind_Checked)
|
||||||
name += "`UCHK";
|
name += "`CHK";
|
||||||
|
else if (methodDef->mCheckedKind == BfCheckedKind_Unchecked)
|
||||||
|
name += "`UCHK";
|
||||||
|
|
||||||
if (methodDef->mHasComptime)
|
if (methodDef->mHasComptime)
|
||||||
name += "`COMPTIME";
|
name += "`COMPTIME";
|
||||||
|
}
|
||||||
|
|
||||||
if (((methodInst->GetOwner()->mTypeDef->IsGlobalsContainer()) &&
|
if (((methodInst->GetOwner()->mTypeDef->IsGlobalsContainer()) &&
|
||||||
((methodDef->mMethodType == BfMethodType_Ctor) || (methodDef->mMethodType == BfMethodType_Dtor) || (methodDef->mName == BF_METHODNAME_MARKMEMBERS_STATIC))) ||
|
((methodDef->mMethodType == BfMethodType_Ctor) || (methodDef->mMethodType == BfMethodType_Dtor) || (methodDef->mName == BF_METHODNAME_MARKMEMBERS_STATIC))) ||
|
||||||
|
@ -1021,12 +1024,22 @@ String BfGNUMangler::Mangle(BfMethodInstance* methodInst)
|
||||||
HandleParamCustomAttributes(paramDecl->mAttributes, false, isConst);
|
HandleParamCustomAttributes(paramDecl->mAttributes, false, isConst);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto paramKind = methodInst->GetParamKind(paramIdx);
|
if (!mangleContext.mCPPMangle)
|
||||||
if (paramKind == BfParamKind_Params)
|
{
|
||||||
name += "U6params";
|
auto paramKind = methodInst->GetParamKind(paramIdx);
|
||||||
else if (paramKind == BfParamKind_DelegateParam)
|
if (paramKind == BfParamKind_Params)
|
||||||
name += "U5param";
|
name += "U6params";
|
||||||
Mangle(mangleContext, name, paramType, NULL, isConst);
|
else if (paramKind == BfParamKind_DelegateParam)
|
||||||
|
name += "U5param";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((paramType->IsVoid()) && (methodInst->GetParamCount() == 1))
|
||||||
|
{
|
||||||
|
// Avoid collision between 'Method()' and 'Method(void)'
|
||||||
|
name += "U4void";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Mangle(mangleContext, name, paramType, NULL, isConst);
|
||||||
}
|
}
|
||||||
if ((methodInst->GetParamCount() == 0) && (!doExplicitThis))
|
if ((methodInst->GetParamCount() == 0) && (!doExplicitThis))
|
||||||
name += 'v';
|
name += 'v';
|
||||||
|
@ -2232,8 +2245,10 @@ void BfMSMangler::Mangle(StringImpl& name, bool is64Bit, BfMethodInstance* metho
|
||||||
{
|
{
|
||||||
Mangle(mangleContext, name, typeInst->GetUnderlyingType(), true);
|
Mangle(mangleContext, name, typeInst->GetUnderlyingType(), true);
|
||||||
}
|
}
|
||||||
for (auto& param : methodInst->mParams)
|
|
||||||
|
for (int paramIdx = 0; paramIdx < methodInst->mParams.mSize; paramIdx++)
|
||||||
{
|
{
|
||||||
|
auto& param = methodInst->mParams[paramIdx];
|
||||||
bool isConst = false;
|
bool isConst = false;
|
||||||
if ((param.mParamDefIdx >= 0) && (methodDeclaration != NULL) && (param.mParamDefIdx < methodDeclaration->mParams.mSize))
|
if ((param.mParamDefIdx >= 0) && (methodDeclaration != NULL) && (param.mParamDefIdx < methodDeclaration->mParams.mSize))
|
||||||
{
|
{
|
||||||
|
@ -2241,6 +2256,14 @@ void BfMSMangler::Mangle(StringImpl& name, bool is64Bit, BfMethodInstance* metho
|
||||||
HandleParamCustomAttributes(paramDecl->mAttributes, false, isConst);
|
HandleParamCustomAttributes(paramDecl->mAttributes, false, isConst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!mangleContext.mCPPMangle)
|
||||||
|
{
|
||||||
|
auto paramKind = methodInst->GetParamKind(paramIdx);
|
||||||
|
if (paramKind == BfParamKind_Params)
|
||||||
|
name += "Tparams@@";
|
||||||
|
else if (paramKind == BfParamKind_DelegateParam)
|
||||||
|
name += "Tparam@@";
|
||||||
|
}
|
||||||
Mangle(mangleContext, name, param.mResolvedType, true, isConst);
|
Mangle(mangleContext, name, param.mResolvedType, true, isConst);
|
||||||
}
|
}
|
||||||
name += '@';
|
name += '@';
|
||||||
|
|
|
@ -23374,9 +23374,8 @@ void BfModule::SetupIRFunction(BfMethodInstance* methodInstance, StringImpl& man
|
||||||
mCurMethodInstance->mMangleWithIdx = true;
|
mCurMethodInstance->mMangleWithIdx = true;
|
||||||
mangledName.Clear();
|
mangledName.Clear();
|
||||||
BfMangler::Mangle(mangledName, mCompiler->GetMangleKind(), mCurMethodInstance);
|
BfMangler::Mangle(mangledName, mCompiler->GetMangleKind(), mCurMethodInstance);
|
||||||
prevFunc = mBfIRBuilder->GetFunction(mangledName);
|
|
||||||
|
|
||||||
BfLogSysM("Function collision forced mangleWithIdx for %p: %d\n", methodInstance, prevFunc.mId);
|
BfLogSysM("Function collision forced mangleWithIdx for %p: %d GenericArgs: %d Unspecialized: %d\n", methodInstance, prevFunc.mId, methodInstance->GetNumGenericArguments(), methodInstance->mIsUnspecialized);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue