From 9e61cdf75d0644c20f5f594839ea4423066810e3 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Tue, 21 May 2024 09:55:09 -0400 Subject: [PATCH] SetCurrentDebugLocation debug check --- IDEHelper/Compiler/BfIRCodeGen.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/IDEHelper/Compiler/BfIRCodeGen.cpp b/IDEHelper/Compiler/BfIRCodeGen.cpp index 6f119a78..f6160879 100644 --- a/IDEHelper/Compiler/BfIRCodeGen.cpp +++ b/IDEHelper/Compiler/BfIRCodeGen.cpp @@ -4764,6 +4764,20 @@ void BfIRCodeGen::HandleNextCmd() column = 0; mCurLine = line; mDebugLoc = llvm::DILocation::get(*mLLVMContext, line, column, diScope, diInlinedAt); + +#ifdef _DEBUG + llvm::DILocation* DL = mDebugLoc; + if (DL != NULL) + { + llvm::Metadata* Parent = DL->getRawScope(); + llvm::DILocalScope* Scope = DL->getInlinedAtScope(); + llvm::DISubprogram* SP = Scope->getSubprogram(); + if (SP != NULL) + { + BF_ASSERT(SP->describes(mActiveFunction)); + } + } +#endif } break; case BfIRCmd_Nop: