1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Fixed recursive debug value alias issue

This commit is contained in:
Brian Fiete 2022-03-01 14:02:31 -08:00
parent cb037979e9
commit 28a03fcc4b

View file

@ -16604,10 +16604,13 @@ void BfExprEvaluator::InjectMixin(BfAstNode* targetSrc, BfTypedValue target, boo
if ((wantsDIData) && (!mModule->mBfIRBuilder->mIgnoreWrites))
{
bool handled = false;
mModule->UpdateSrcPos(methodDeclaration->mNameNode);
if (hasConstValue)
{
// Already handled
handled = true;
}
else if (newLocalVar->mIsSplat)
{
@ -16625,6 +16628,33 @@ void BfExprEvaluator::InjectMixin(BfAstNode* targetSrc, BfTypedValue target, boo
if (newLocalVar->mValue != localVar->mAddr)
continue;
bool isDupName = false;
for (auto param : methodDef->mParams)
{
if (param->mName == localVar->mName)
{
isDupName = true;
break;
}
}
if (isDupName)
{
auto splatAgg = mModule->AggregateSplat(BfTypedValue(newLocalVar->mValue, newLocalVar->mResolvedType, BfTypedValueKind_SplatHead));
// Don't allow alias if one of our args has the same name
newLocalVar->mIsSplat = false;
newLocalVar->mValue = BfIRValue();
if (splatAgg.IsAddr())
newLocalVar->mAddr = splatAgg.mValue;
else
newLocalVar->mValue = splatAgg.mValue;
found = true;
break;
}
String name = "$";
name += newLocalVar->mName;
name += "$alias$";
@ -16641,6 +16671,7 @@ void BfExprEvaluator::InjectMixin(BfAstNode* targetSrc, BfTypedValue target, boo
name, mModule->mCurFilePosition.mFileInstance->mDIFile, mModule->mCurFilePosition.mCurLine, diType);
mModule->mBfIRBuilder->DbgInsertValueIntrinsic(mModule->mBfIRBuilder->CreateConstNull(), diVariable);
handled = true;
found = true;
break;
}
@ -16648,6 +16679,11 @@ void BfExprEvaluator::InjectMixin(BfAstNode* targetSrc, BfTypedValue target, boo
checkMethodState = checkMethodState->mPrevMethodState;
}
}
if (handled)
{
//
}
else if (mModule->IsTargetingBeefBackend())
{
mModule->UpdateSrcPos(methodDeclaration->mNameNode);