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

LLVM 13 debug info fixes

This commit is contained in:
Brian Fiete 2022-02-07 14:27:05 -05:00
parent d85f164b8a
commit 3635e3830a
3 changed files with 21 additions and 11 deletions

View file

@ -2670,6 +2670,7 @@ void BeIRCodeGen::HandleNextCmd()
CMD_PARAM(int, column);
CMD_PARAM(BeMDNode*, diScope);
CMD_PARAM(BeMDNode*, diInlinedAt);
BF_ASSERT(diScope != NULL);
mBeModule->SetCurrentDebugLocation(line - 1, column - 1, diScope, (BeDbgLoc*)diInlinedAt);
}
break;

View file

@ -5396,6 +5396,7 @@ void BfIRBuilder::UpdateDebugLocation(BfIRValue inst)
void BfIRBuilder::SetCurrentDebugLocation(int line, int column, BfIRMDNode diScope, BfIRMDNode diInlinedAt)
{
BF_ASSERT(diScope);
if (mDbgVerifyCodeGen && gDebugDbgLoc)
{
OutputDebugStrF("SetCurrentDebugLocation %d %d:%d\n", diScope.mId, line, column);

View file

@ -2616,7 +2616,11 @@ void BfModule::UpdateSrcPos(BfAstNode* astNode, BfSrcPosFlags flags, int debugLo
if ((!useDIScope) && (mIsComptimeModule))
useDIScope = wantDIFile;
mBfIRBuilder->SetCurrentDebugLocation(mCurFilePosition.mCurLine + 1, column, useDIScope, inlineAt);
if (!useDIScope)
mBfIRBuilder->ClearDebugLocation();
else
mBfIRBuilder->SetCurrentDebugLocation(mCurFilePosition.mCurLine + 1, column, useDIScope, inlineAt);
if ((flags & BfSrcPosFlag_Expression) == 0)
mBfIRBuilder->CreateStatementStart();
}
@ -2639,15 +2643,19 @@ void BfModule::SetIllegalSrcPos(BfSrcPosFlags flags)
{
if ((mBfIRBuilder->DbgHasInfo()) && (mCurMethodState != NULL))
{
if ((mCurMethodState->mCurScope->mDIInlinedAt) && (mCompiler->mOptions.IsCodeView()))
auto curScope = mCurMethodState->mCurScope->mDIScope;
if (curScope)
{
// Currently, CodeView does not record column positions so we can't use an illegal column position as an "invalid" marker
mBfIRBuilder->SetCurrentDebugLocation(0, 0, mCurMethodState->mCurScope->mDIScope, mCurMethodState->mCurScope->mDIInlinedAt);
}
else
{
// Set to whatever it previously was but at column zero, which we will know to be illegal
mBfIRBuilder->SetCurrentDebugLocation(mCurFilePosition.mCurLine + 1, 0, mCurMethodState->mCurScope->mDIScope, mCurMethodState->mCurScope->mDIInlinedAt);
if ((mCurMethodState->mCurScope->mDIInlinedAt) && (mCompiler->mOptions.IsCodeView()))
{
// Currently, CodeView does not record column positions so we can't use an illegal column position as an "invalid" marker
mBfIRBuilder->SetCurrentDebugLocation(0, 0, curScope, mCurMethodState->mCurScope->mDIInlinedAt);
}
else
{
// Set to whatever it previously was but at column zero, which we will know to be illegal
mBfIRBuilder->SetCurrentDebugLocation(mCurFilePosition.mCurLine + 1, 0, curScope, mCurMethodState->mCurScope->mDIInlinedAt);
}
}
if ((flags & BfSrcPosFlag_Expression) == 0)