mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 03:52:19 +02:00
LLVM 13 debug info fixes
This commit is contained in:
parent
d85f164b8a
commit
3635e3830a
3 changed files with 21 additions and 11 deletions
|
@ -2670,6 +2670,7 @@ void BeIRCodeGen::HandleNextCmd()
|
||||||
CMD_PARAM(int, column);
|
CMD_PARAM(int, column);
|
||||||
CMD_PARAM(BeMDNode*, diScope);
|
CMD_PARAM(BeMDNode*, diScope);
|
||||||
CMD_PARAM(BeMDNode*, diInlinedAt);
|
CMD_PARAM(BeMDNode*, diInlinedAt);
|
||||||
|
BF_ASSERT(diScope != NULL);
|
||||||
mBeModule->SetCurrentDebugLocation(line - 1, column - 1, diScope, (BeDbgLoc*)diInlinedAt);
|
mBeModule->SetCurrentDebugLocation(line - 1, column - 1, diScope, (BeDbgLoc*)diInlinedAt);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -5396,6 +5396,7 @@ void BfIRBuilder::UpdateDebugLocation(BfIRValue inst)
|
||||||
|
|
||||||
void BfIRBuilder::SetCurrentDebugLocation(int line, int column, BfIRMDNode diScope, BfIRMDNode diInlinedAt)
|
void BfIRBuilder::SetCurrentDebugLocation(int line, int column, BfIRMDNode diScope, BfIRMDNode diInlinedAt)
|
||||||
{
|
{
|
||||||
|
BF_ASSERT(diScope);
|
||||||
if (mDbgVerifyCodeGen && gDebugDbgLoc)
|
if (mDbgVerifyCodeGen && gDebugDbgLoc)
|
||||||
{
|
{
|
||||||
OutputDebugStrF("SetCurrentDebugLocation %d %d:%d\n", diScope.mId, line, column);
|
OutputDebugStrF("SetCurrentDebugLocation %d %d:%d\n", diScope.mId, line, column);
|
||||||
|
|
|
@ -2616,6 +2616,10 @@ void BfModule::UpdateSrcPos(BfAstNode* astNode, BfSrcPosFlags flags, int debugLo
|
||||||
|
|
||||||
if ((!useDIScope) && (mIsComptimeModule))
|
if ((!useDIScope) && (mIsComptimeModule))
|
||||||
useDIScope = wantDIFile;
|
useDIScope = wantDIFile;
|
||||||
|
|
||||||
|
if (!useDIScope)
|
||||||
|
mBfIRBuilder->ClearDebugLocation();
|
||||||
|
else
|
||||||
mBfIRBuilder->SetCurrentDebugLocation(mCurFilePosition.mCurLine + 1, column, useDIScope, inlineAt);
|
mBfIRBuilder->SetCurrentDebugLocation(mCurFilePosition.mCurLine + 1, column, useDIScope, inlineAt);
|
||||||
if ((flags & BfSrcPosFlag_Expression) == 0)
|
if ((flags & BfSrcPosFlag_Expression) == 0)
|
||||||
mBfIRBuilder->CreateStatementStart();
|
mBfIRBuilder->CreateStatementStart();
|
||||||
|
@ -2638,16 +2642,20 @@ void BfModule::UseDefaultSrcPos(BfSrcPosFlags flags, int debugLocOffset)
|
||||||
void BfModule::SetIllegalSrcPos(BfSrcPosFlags flags)
|
void BfModule::SetIllegalSrcPos(BfSrcPosFlags flags)
|
||||||
{
|
{
|
||||||
if ((mBfIRBuilder->DbgHasInfo()) && (mCurMethodState != NULL))
|
if ((mBfIRBuilder->DbgHasInfo()) && (mCurMethodState != NULL))
|
||||||
|
{
|
||||||
|
auto curScope = mCurMethodState->mCurScope->mDIScope;
|
||||||
|
if (curScope)
|
||||||
{
|
{
|
||||||
if ((mCurMethodState->mCurScope->mDIInlinedAt) && (mCompiler->mOptions.IsCodeView()))
|
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
|
// 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);
|
mBfIRBuilder->SetCurrentDebugLocation(0, 0, curScope, mCurMethodState->mCurScope->mDIInlinedAt);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Set to whatever it previously was but at column zero, which we will know to be illegal
|
// 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);
|
mBfIRBuilder->SetCurrentDebugLocation(mCurFilePosition.mCurLine + 1, 0, curScope, mCurMethodState->mCurScope->mDIInlinedAt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((flags & BfSrcPosFlag_Expression) == 0)
|
if ((flags & BfSrcPosFlag_Expression) == 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue