[clang] [llvm] [DebugInfo] Update DIBuilder insertion to take InsertPosition (PR #126059)

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 12 08:28:58 PST 2025


================
@@ -1686,7 +1686,8 @@ LLVMDbgRecordRef LLVMDIBuilderInsertDeclareRecordBefore(
   DbgInstPtr DbgInst = unwrap(Builder)->insertDeclare(
       unwrap(Storage), unwrap<DILocalVariable>(VarInfo),
       unwrap<DIExpression>(Expr), unwrap<DILocation>(DL),
-      unwrap<Instruction>(Instr));
+      Instr ? InsertPosition(unwrap<Instruction>(Instr)->getIterator())
+            : nullptr);
----------------
OCHyams wrote:

Thanks for unpicking that.

> This is a messy situation and in this PR I tried to just keep that exactly the same. What previously worked should still work. What previously didn't work should still not work.

SGTM. I feel as though these functions should probably have asserts in them saying as such but that could reasonably be argued to be out of scope of the patch.

Patch LGTM to me too.

https://github.com/llvm/llvm-project/pull/126059


More information about the llvm-commits mailing list