[clang] [llvm] [DebugInfo] Update DIBuilder insertion to take InsertPosition (PR #126059)
    Orlando Cazalet-Hyams via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Wed Feb 12 06:21:35 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:
Wouldn't this trip an assertion in the `nullptr` InsertPosition case (`assert(InsertPt.isValid());` in `insertDbgVariableRecord` called by `insertDeclare`). Or am I reading this wrong? (Same question applies to the other calls below)
https://github.com/llvm/llvm-project/pull/126059
    
    
More information about the cfe-commits
mailing list