[clang] [llvm] [DebugInfo] Update DIBuilder insertion to take InsertPosition (PR #126059)
Harald van Dijk via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 7 08:59:44 PST 2025
================
@@ -1708,19 +1706,9 @@ static void insertDbgValueOrDbgVariableRecord(DIBuilder &Builder, Value *DV,
static void insertDbgValueOrDbgVariableRecordAfter(
DIBuilder &Builder, Value *DV, DILocalVariable *DIVar, DIExpression *DIExpr,
- const DebugLoc &NewLoc, BasicBlock::iterator Instr) {
- if (!UseNewDbgInfoFormat) {
- auto DbgVal = Builder.insertDbgValueIntrinsic(DV, DIVar, DIExpr, NewLoc,
- (Instruction *)nullptr);
- cast<Instruction *>(DbgVal)->insertAfter(Instr);
- } else {
- // RemoveDIs: if we're using the new debug-info format, allocate a
- // DbgVariableRecord directly instead of a dbg.value intrinsic.
- ValueAsMetadata *DVAM = ValueAsMetadata::get(DV);
- DbgVariableRecord *DV =
- new DbgVariableRecord(DVAM, DIVar, DIExpr, NewLoc.get());
- Instr->getParent()->insertDbgRecordAfter(DV, &*Instr);
- }
+ const DebugLoc &NewLoc, Instruction *Instr) {
+ insertDbgValueOrDbgVariableRecord(Builder, DV, DIVar, DIExpr, NewLoc,
+ std::next(Instr->getIterator()));
----------------
hvdijk wrote:
I think you're right, thanks, will update and re-test.
https://github.com/llvm/llvm-project/pull/126059
More information about the cfe-commits
mailing list