Browse Source

SetCurrentDebugLocation debug check

Brian Fiete 1 year ago
parent
commit
9e61cdf75d
1 changed files with 14 additions and 0 deletions
  1. 14 0
      IDEHelper/Compiler/BfIRCodeGen.cpp

+ 14 - 0
IDEHelper/Compiler/BfIRCodeGen.cpp

@@ -4764,6 +4764,20 @@ void BfIRCodeGen::HandleNextCmd()
 				column = 0;
 				column = 0;
 			mCurLine = line;
 			mCurLine = line;
 			mDebugLoc = llvm::DILocation::get(*mLLVMContext, line, column, diScope, diInlinedAt);
 			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;
 		break;
 	case BfIRCmd_Nop:
 	case BfIRCmd_Nop: