@@ -333,13 +333,42 @@ CL_LAMBDA(dibuilder scope name argno file lineno type always-preserve-p flags an
333333CL_LISPIFY_NAME (createParameterVariable);
334334CL_EXTERN_DEFMETHOD (DIBuilder_O, &llvm::DIBuilder::createParameterVariable);
335335
336- // We don't expose the instruction version since we don't really need it.
336+ // We want to use these instead of manually inserting an intrinsic
337+ // call so that when LLVM transitions to debug info records we
338+ // don't have to do anything.
339+ // (Despite the name, insertDbgValueIntrinsic can insert the new
340+ // records rather than an intrinsic.)
341+ // We don't expose the insert-before-instruction versions as we
342+ // do not need them.
343+ // FIXME: Function instead of a method because we don't really
344+ // care about the DbgInstPtr return value and exposing it would
345+ // be rather complex.
337346CL_LAMBDA (dibuilder val varinfo expr dilocation basic-block);
338- CL_LISPIFY_NAME (insertDbgValueIntrinsic);
339- CL_EXTERN_DEFMETHOD (DIBuilder_O, (llvm::Instruction * (llvm::DIBuilder::*)(llvm::Value * Val, llvm::DILocalVariable* VarInfo,
340- llvm::DIExpression* Expr, const llvm::DILocation* DL,
341- llvm::BasicBlock* InsertAtEnd)) &
342- llvm::DIBuilder::insertDbgValueIntrinsic);
347+ CL_LISPIFY_NAME (dibuilder/insertDbgValueIntrinsic);
348+ CL_DEFUN void llvm_sys__insert_dbg_value (llvm::DIBuilder& DIBuilder,
349+ llvm::Value* V,
350+ llvm::DILocalVariable* VarInfo,
351+ llvm::DIExpression* Expr,
352+ DILocation_sp DL,
353+ llvm::BasicBlock* InsertAtEnd)
354+ {
355+ // FIXME: why not just use from_object?
356+ // This is cargo-culted from IRBuilderBase_O::SetCurrentDebugLocation
357+ llvm::DILocation* real_diloc = DL->operator llvm::DILocation*();
358+ DIBuilder.insertDbgValueIntrinsic (V, VarInfo, Expr, real_diloc, InsertAtEnd);
359+ }
360+ CL_LAMBDA (dibuilder val varinfo expr dilocation basic-block);
361+ CL_LISPIFY_NAME (dibuilder/insertDeclare);
362+ CL_DEFUN void llvm_sys__insert_declare (llvm::DIBuilder& DIBuilder,
363+ llvm::Value* Storage,
364+ llvm::DILocalVariable* VarInfo,
365+ llvm::DIExpression* Expr,
366+ DILocation_sp DL,
367+ llvm::BasicBlock* InsertAtEnd)
368+ {
369+ llvm::DILocation* real_diloc = DL->operator llvm::DILocation*();
370+ DIBuilder.insertDeclare (Storage, VarInfo, Expr, real_diloc, InsertAtEnd);
371+ }
343372
344373CL_LAMBDA (dibuilder);
345374CL_LISPIFY_NAME (finalize);
0 commit comments