From e50a1a3134250cbf23d4d4aff36a6fdf16ffbbd9 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Mon, 9 Sep 2024 10:29:59 -0400 Subject: [PATCH] SetCurrentDebugLocation after BfIRCmd_SetInsertPointAtStart --- IDEHelper/Compiler/BfIRCodeGen.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/IDEHelper/Compiler/BfIRCodeGen.cpp b/IDEHelper/Compiler/BfIRCodeGen.cpp index f6160879..3d0b70e5 100644 --- a/IDEHelper/Compiler/BfIRCodeGen.cpp +++ b/IDEHelper/Compiler/BfIRCodeGen.cpp @@ -511,6 +511,19 @@ void pve(const BfIRTypedValue& typedValue) pte(typedValue.mTypeEx); } +void pirb(llvm::IRBuilder<>* irBuilder) +{ + Beefy::debug_ostream os; + os << "Debug loc: "; + auto debugLoc = irBuilder->getCurrentDebugLocation(); + if (debugLoc.get() == NULL) + os << "NULL"; + else + debugLoc->print(os); + os << "\n"; + os.flush(); +} + void BfIRCodeGen::FixValues(llvm::StructType* structType, llvm::SmallVector& values) { if (values.size() >= structType->getNumElements()) @@ -3076,7 +3089,9 @@ void BfIRCodeGen::HandleNextCmd() case BfIRCmd_SetInsertPointAtStart: { CMD_PARAM(llvm::BasicBlock*, block); - mIRBuilder->SetInsertPoint(block, block->begin()); + mIRBuilder->SetInsertPoint(block, block->begin()); + // SetInsertPoint can clear the debug loc so reset it here + mIRBuilder->SetCurrentDebugLocation(mDebugLoc); } break; case BfIRCmd_EraseFromParent: