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

Copy composites for interop calling conventions

This commit is contained in:
Brian Fiete 2022-02-04 10:29:23 -05:00
parent 904d2aae6c
commit bb49f819ad
3 changed files with 28 additions and 7 deletions

View file

@ -314,6 +314,12 @@ void BfGNUMangler::MangleTypeInst(MangleContext& mangleContext, StringImpl& name
typeVec.push_back(BfNodeDynCast<BfDirectTypeReference>(methodDef->mReturnTypeRef)->mType);
if (methodDef->mIsMutating)
name += "_mut_";
if (delegateInfo->mCallingConvention == BfCallingConvention_Cdecl)
name += "_cdecl_";
else if (delegateInfo->mCallingConvention == BfCallingConvention_Stdcall)
name += "_stdcall_";
else if (delegateInfo->mCallingConvention == BfCallingConvention_Fastcall)
name += "_fastcall_";
for (int paramIdx = 0; paramIdx < (int)methodDef->mParams.size(); paramIdx++)
{
name += "_";
@ -1227,7 +1233,7 @@ bool BfMSMangler::FindOrCreateNameSub(MangleContext& mangleContext, StringImpl&
BF_ASSERT(newNameSub.mTypeInst->mTypeDef->mMethods[0]->mName == "Invoke");
auto delegateInfo = newNameSub.mTypeInst->GetDelegateInfo();
auto methodDef = newNameSub.mTypeInst->mTypeDef->mMethods[0];
if (newNameSub.mTypeInst->IsDelegate())
name += "?$delegate";
@ -1235,6 +1241,13 @@ bool BfMSMangler::FindOrCreateNameSub(MangleContext& mangleContext, StringImpl&
name += "?$function";
if (methodDef->mIsMutating)
name += "_mut_";
if (delegateInfo->mCallingConvention == BfCallingConvention_Cdecl)
name += "_cdecl_";
else if (delegateInfo->mCallingConvention == BfCallingConvention_Stdcall)
name += "_stdcall_";
else if (delegateInfo->mCallingConvention == BfCallingConvention_Fastcall)
name += "_fastcall_";
SizedArray<BfType*, 8> typeVec;
typeVec.push_back(BfNodeDynCast<BfDirectTypeReference>(methodDef->mReturnTypeRef)->mType);