1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

Fixed debug info for static local variables

This commit is contained in:
Brian Fiete 2022-06-17 12:19:19 -07:00
parent 67b30b639d
commit 485316385b

View file

@ -15195,6 +15195,16 @@ void BfModule::DoLocalVariableDebugInfo(BfLocalVariable* localVarDef, bool doAli
if (!mBfIRBuilder->mIgnoreWrites)
{
if ((localVarDef->mIsStatic) && (localVarDef->mAddr) && (!localVarDef->mResolvedType->IsValuelessType()))
{
auto refType = CreateRefType(localVarDef->mResolvedType);
diType = mBfIRBuilder->DbgGetType(refType);
auto refAlloca = CreateAlloca(refType);
mBfIRBuilder->CreateStore(localVarDef->mAddr, refAlloca);
diValue = refAlloca;
}
auto diVariable = mBfIRBuilder->DbgCreateAutoVariable(mCurMethodState->mCurScope->mDIScope,
localVarDef->mName, mCurFilePosition.mFileInstance->mDIFile, mCurFilePosition.mCurLine, diType, initType);
localVarDef->mDbgVarInst = diVariable;