mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Fixed GNU const ref mangling
This commit is contained in:
parent
fa0e712c2b
commit
4c5881e5d3
2 changed files with 12 additions and 4 deletions
|
@ -396,7 +396,7 @@ void BfGNUMangler::MangleTypeInst(MangleContext& mangleContext, StringImpl& name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BfGNUMangler::Mangle(MangleContext& mangleContext, StringImpl& name, BfType* type, BfType* postfixType)
|
void BfGNUMangler::Mangle(MangleContext& mangleContext, StringImpl& name, BfType* type, BfType* postfixType, bool isConst)
|
||||||
{
|
{
|
||||||
static int sCallCount = 0;
|
static int sCallCount = 0;
|
||||||
sCallCount++;
|
sCallCount++;
|
||||||
|
@ -549,7 +549,7 @@ void BfGNUMangler::Mangle(MangleContext& mangleContext, StringImpl& name, BfType
|
||||||
}
|
}
|
||||||
int startIdx = (int)name.length();
|
int startIdx = (int)name.length();
|
||||||
Mangle(mangleContext, name, refType->mElementType);
|
Mangle(mangleContext, name, refType->mElementType);
|
||||||
AddPrefix(mangleContext, name, startIdx, "R");
|
AddPrefix(mangleContext, name, startIdx, isConst ? "RK" : "R");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (type->IsModifiedTypeType())
|
else if (type->IsModifiedTypeType())
|
||||||
|
@ -683,6 +683,7 @@ String BfGNUMangler::Mangle(BfMethodInstance* methodInst)
|
||||||
}
|
}
|
||||||
|
|
||||||
auto methodDef = methodInst->mMethodDef;
|
auto methodDef = methodInst->mMethodDef;
|
||||||
|
auto methodDeclaration = BfNodeDynCastExact<BfMethodDeclaration>(methodDef->mMethodDeclaration);
|
||||||
auto typeInst = methodInst->GetOwner();
|
auto typeInst = methodInst->GetOwner();
|
||||||
auto typeDef = typeInst->mTypeDef;
|
auto typeDef = typeInst->mTypeDef;
|
||||||
|
|
||||||
|
@ -969,12 +970,19 @@ String BfGNUMangler::Mangle(BfMethodInstance* methodInst)
|
||||||
{
|
{
|
||||||
BfType* paramType = methodInst->GetParamType(paramIdx);
|
BfType* paramType = methodInst->GetParamType(paramIdx);
|
||||||
|
|
||||||
|
bool isConst = false;
|
||||||
|
if ((methodDeclaration != NULL) && (paramIdx < methodDeclaration->mParams.mSize))
|
||||||
|
{
|
||||||
|
auto paramDecl = methodDeclaration->mParams[paramIdx];
|
||||||
|
HandleParamCustomAttributes(paramDecl->mAttributes, false, isConst);
|
||||||
|
}
|
||||||
|
|
||||||
auto paramKind = methodInst->GetParamKind(paramIdx);
|
auto paramKind = methodInst->GetParamKind(paramIdx);
|
||||||
if (paramKind == BfParamKind_Params)
|
if (paramKind == BfParamKind_Params)
|
||||||
name += "U6params";
|
name += "U6params";
|
||||||
else if (paramKind == BfParamKind_DelegateParam)
|
else if (paramKind == BfParamKind_DelegateParam)
|
||||||
name += "U5param";
|
name += "U5param";
|
||||||
Mangle(mangleContext, name, paramType);
|
Mangle(mangleContext, name, paramType, NULL, isConst);
|
||||||
}
|
}
|
||||||
if ((methodInst->GetParamCount() == 0) && (!doExplicitThis))
|
if ((methodInst->GetParamCount() == 0) && (!doExplicitThis))
|
||||||
name += 'v';
|
name += 'v';
|
||||||
|
|
|
@ -124,7 +124,7 @@ public:
|
||||||
public:
|
public:
|
||||||
static void MangleTypeInst(MangleContext& mangleContext, StringImpl& name, BfTypeInstance* typeInst, BfTypeInstance* postfixTypeInst = NULL, bool* isEndOpen = NULL);
|
static void MangleTypeInst(MangleContext& mangleContext, StringImpl& name, BfTypeInstance* typeInst, BfTypeInstance* postfixTypeInst = NULL, bool* isEndOpen = NULL);
|
||||||
|
|
||||||
static void Mangle(MangleContext& mangleContext, StringImpl& name, BfType* type, BfType* postfixType = NULL);
|
static void Mangle(MangleContext& mangleContext, StringImpl& name, BfType* type, BfType* postfixType = NULL, bool isConst = false);
|
||||||
static String Mangle(BfType* type, BfModule* module = NULL);
|
static String Mangle(BfType* type, BfModule* module = NULL);
|
||||||
static String Mangle(BfMethodInstance* methodRef);
|
static String Mangle(BfMethodInstance* methodRef);
|
||||||
static String MangleMethodName(BfTypeInstance* type, const StringImpl& methodName);
|
static String MangleMethodName(BfTypeInstance* type, const StringImpl& methodName);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue