1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +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

@ -2669,7 +2669,8 @@ void BeIRCodeGen::HandleNextCmd()
CMD_PARAM(int, line); CMD_PARAM(int, line);
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;

View file

@ -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);

View file

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