mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-14 14:24:10 +02:00
Fixed debug location of comptime mixins
This commit is contained in:
parent
7b0aa874ce
commit
e8a8985734
1 changed files with 0 additions and 41 deletions
|
@ -2589,8 +2589,6 @@ void BfModule::CEMixin(BfAstNode* refNode, const StringImpl& code)
|
||||||
SetAndRestoreValue<BfAstNode*> prevCustomAttribute(mCurMethodState->mEmitRefNode, refNode);
|
SetAndRestoreValue<BfAstNode*> prevCustomAttribute(mCurMethodState->mEmitRefNode, refNode);
|
||||||
|
|
||||||
EmitEnsureInstructionAt();
|
EmitEnsureInstructionAt();
|
||||||
bool wantsDIData = (mBfIRBuilder->DbgHasInfo()) && (mHasFullDebugInfo);
|
|
||||||
mBfIRBuilder->SaveDebugLocation();
|
|
||||||
|
|
||||||
BfCEParseContext ceParseContext = CEEmitParse(mCurTypeInstance, activeTypeDef, src, refNode, BfCeTypeEmitSourceKind_Method);
|
BfCEParseContext ceParseContext = CEEmitParse(mCurTypeInstance, activeTypeDef, src, refNode, BfCeTypeEmitSourceKind_Method);
|
||||||
auto emitParser = mCurTypeInstance->mTypeDef->mSource->ToParser();
|
auto emitParser = mCurTypeInstance->mTypeDef->mSource->ToParser();
|
||||||
|
@ -2598,42 +2596,6 @@ void BfModule::CEMixin(BfAstNode* refNode, const StringImpl& code)
|
||||||
bfReducer.mAlloc = emitParser->mAlloc;
|
bfReducer.mAlloc = emitParser->mAlloc;
|
||||||
bfReducer.HandleBlock(emitParser->mRootNode, false);
|
bfReducer.HandleBlock(emitParser->mRootNode, false);
|
||||||
|
|
||||||
SetAndRestoreValue<BfIRMDNode> prevInlinedAt(mCurMethodState->mCurScope->mDIInlinedAt);
|
|
||||||
SetAndRestoreValue<BfIRMDNode> prevDIScope(mCurMethodState->mCurScope->mDIScope);
|
|
||||||
SetAndRestoreValue<BfIRMDNode> prevAltDIFile(mCurMethodState->mCurScope->mAltDIFile);
|
|
||||||
|
|
||||||
if (wantsDIData)
|
|
||||||
{
|
|
||||||
llvm::SmallVector<BfIRMDNode, 8> diParams;
|
|
||||||
diParams.push_back(mBfIRBuilder->DbgGetType(GetPrimitiveType(BfTypeCode_None)));
|
|
||||||
BfIRMDNode diFuncType = mBfIRBuilder->DbgCreateSubroutineType(diParams);
|
|
||||||
|
|
||||||
//int defLine = mModule->mCurFilePosition.mCurLine;
|
|
||||||
|
|
||||||
int flags = 0;
|
|
||||||
mCurMethodState->mCurScope->mDIInlinedAt = mBfIRBuilder->DbgGetCurrentLocation();
|
|
||||||
|
|
||||||
// We used to have the "def" line be the inlining position, but the linker we de-duplicate instances of these functions without regard to their unique line
|
|
||||||
// definitions, so we need to be consistent and use the actual line
|
|
||||||
UpdateSrcPos(emitParser->mRootNode, BfSrcPosFlag_NoSetDebugLoc);
|
|
||||||
int defLine = mCurFilePosition.mCurLine;
|
|
||||||
auto diParentType = mBfIRBuilder->DbgGetTypeInst(mCurTypeInstance);
|
|
||||||
if (!mBfIRBuilder->mIgnoreWrites)
|
|
||||||
{
|
|
||||||
String methodName = "Comptime_Mixin";
|
|
||||||
String linkageName;
|
|
||||||
if (mIsComptimeModule)
|
|
||||||
linkageName = StrFormat("Comptime_Mixin:%llX", mCurMethodInstance);
|
|
||||||
mCurMethodState->mCurScope->mDIScope = mBfIRBuilder->DbgCreateFunction(diParentType, methodName, "", mCurFilePosition.mFileInstance->mDIFile,
|
|
||||||
defLine + 1, diFuncType, false, true, mCurFilePosition.mCurLine + 1, flags, false, BfIRValue());
|
|
||||||
mCurMethodState->mCurScope->mAltDIFile = mCurFilePosition.mFileInstance->mDIFile;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
UpdateSrcPos(emitParser->mRootNode);
|
|
||||||
|
|
||||||
SetIllegalSrcPos();
|
|
||||||
|
|
||||||
if (emitParser->mSourceClassifier != NULL)
|
if (emitParser->mSourceClassifier != NULL)
|
||||||
{
|
{
|
||||||
emitParser->mSourceClassifier->VisitChild(emitParser->mRootNode);
|
emitParser->mSourceClassifier->VisitChild(emitParser->mRootNode);
|
||||||
|
@ -2643,9 +2605,6 @@ void BfModule::CEMixin(BfAstNode* refNode, const StringImpl& code)
|
||||||
|
|
||||||
Visit(emitParser->mRootNode);
|
Visit(emitParser->mRootNode);
|
||||||
|
|
||||||
mBfIRBuilder->RestoreDebugLocation();
|
|
||||||
mBfIRBuilder->DupDebugLocation();
|
|
||||||
|
|
||||||
prevCustomAttribute.Restore();
|
prevCustomAttribute.Restore();
|
||||||
|
|
||||||
FinishCEParseContext(refNode, mCurTypeInstance, &ceParseContext);
|
FinishCEParseContext(refNode, mCurTypeInstance, &ceParseContext);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue