From e8a8985734362ba02895633441bc97c7618d4a5a Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Fri, 3 Jun 2022 10:26:04 -0700 Subject: [PATCH] Fixed debug location of comptime mixins --- IDEHelper/Compiler/BfModuleTypeUtils.cpp | 41 ------------------------ 1 file changed, 41 deletions(-) diff --git a/IDEHelper/Compiler/BfModuleTypeUtils.cpp b/IDEHelper/Compiler/BfModuleTypeUtils.cpp index b9ec5e06..287c1b9a 100644 --- a/IDEHelper/Compiler/BfModuleTypeUtils.cpp +++ b/IDEHelper/Compiler/BfModuleTypeUtils.cpp @@ -2589,8 +2589,6 @@ void BfModule::CEMixin(BfAstNode* refNode, const StringImpl& code) SetAndRestoreValue prevCustomAttribute(mCurMethodState->mEmitRefNode, refNode); EmitEnsureInstructionAt(); - bool wantsDIData = (mBfIRBuilder->DbgHasInfo()) && (mHasFullDebugInfo); - mBfIRBuilder->SaveDebugLocation(); BfCEParseContext ceParseContext = CEEmitParse(mCurTypeInstance, activeTypeDef, src, refNode, BfCeTypeEmitSourceKind_Method); auto emitParser = mCurTypeInstance->mTypeDef->mSource->ToParser(); @@ -2598,42 +2596,6 @@ void BfModule::CEMixin(BfAstNode* refNode, const StringImpl& code) bfReducer.mAlloc = emitParser->mAlloc; bfReducer.HandleBlock(emitParser->mRootNode, false); - SetAndRestoreValue prevInlinedAt(mCurMethodState->mCurScope->mDIInlinedAt); - SetAndRestoreValue prevDIScope(mCurMethodState->mCurScope->mDIScope); - SetAndRestoreValue prevAltDIFile(mCurMethodState->mCurScope->mAltDIFile); - - if (wantsDIData) - { - llvm::SmallVector 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) { emitParser->mSourceClassifier->VisitChild(emitParser->mRootNode); @@ -2643,9 +2605,6 @@ void BfModule::CEMixin(BfAstNode* refNode, const StringImpl& code) Visit(emitParser->mRootNode); - mBfIRBuilder->RestoreDebugLocation(); - mBfIRBuilder->DupDebugLocation(); - prevCustomAttribute.Restore(); FinishCEParseContext(refNode, mCurTypeInstance, &ceParseContext);