diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst --- a/llvm/docs/ReleaseNotes.rst +++ b/llvm/docs/ReleaseNotes.rst @@ -128,7 +128,8 @@ Changes to the C API -------------------- -* ... +* ``LLVMSetInstDebugLocation`` has been deprecated in favor of the more general + ``LLVMAddMetadataToInst``. Changes to the Go bindings -------------------------- diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h --- a/llvm/include/llvm-c/Core.h +++ b/llvm/include/llvm-c/Core.h @@ -3611,10 +3611,20 @@ * current debug location for the given builder. If the builder has no current * debug location, this function is a no-op. * + * @deprecated LLVMSetInstDebugLocation is deprecated in favor of the more general + * LLVMAddMetadataToInst. + * * @see llvm::IRBuilder::SetInstDebugLocation() */ void LLVMSetInstDebugLocation(LLVMBuilderRef Builder, LLVMValueRef Inst); +/** + * Adds the metadata registered with the given builder to the given instruction. + * + * @see llvm::IRBuilder::AddMetadataToInst() + */ +void LLVMAddMetadataToInst(LLVMBuilderRef Builder, LLVMValueRef Inst); + /** * Get the dafult floating-point math metadata for a given builder. * diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp --- a/llvm/lib/IR/Core.cpp +++ b/llvm/lib/IR/Core.cpp @@ -3133,6 +3133,10 @@ unwrap(Builder)->SetInstDebugLocation(unwrap(Inst)); } +void LLVMAddMetadataToInst(LLVMBuilderRef Builder, LLVMValueRef Inst) { + unwrap(Builder)->AddMetadataToInst(unwrap(Inst)); +} + void LLVMBuilderSetDefaultFPMathTag(LLVMBuilderRef Builder, LLVMMetadataRef FPMathTag) { diff --git a/llvm/tools/llvm-c-test/echo.cpp b/llvm/tools/llvm-c-test/echo.cpp --- a/llvm/tools/llvm-c-test/echo.cpp +++ b/llvm/tools/llvm-c-test/echo.cpp @@ -856,7 +856,7 @@ LLVMSetMetadata(Dst, Kind, LLVMMetadataAsValue(Ctx, MD)); } LLVMDisposeValueMetadataEntries(AllMetadata); - LLVMSetInstDebugLocation(Builder, Dst); + LLVMAddMetadataToInst(Builder, Dst); check_value_kind(Dst, LLVMInstructionValueKind); return VMap[Src] = Dst;