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

Harald van Dijk via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 12 09:41:07 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);
----------------
hvdijk wrote:

Thanks! I think for consistency, it would be nice to update these functions so that they all treat `nullptr` consistently, as a request to create whatever the function says to create but not insert it anywhere. When I have some extra time I'll see if that's easy to do.

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


More information about the cfe-commits mailing list