diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst index 1a9e63409b8d..cbfb05421ff3 100644 --- a/llvm/docs/ReleaseNotes.rst +++ b/llvm/docs/ReleaseNotes.rst @@ -128,7 +128,8 @@ Changes to the OCaml bindings 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 index 7330e247152d..a7324c678780 100644 --- a/llvm/include/llvm-c/Core.h +++ b/llvm/include/llvm-c/Core.h @@ -3611,10 +3611,20 @@ void LLVMSetCurrentDebugLocation2(LLVMBuilderRef Builder, LLVMMetadataRef Loc); * 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 index 4705a06c35b6..905372982dc2 100644 --- a/llvm/lib/IR/Core.cpp +++ b/llvm/lib/IR/Core.cpp @@ -3133,6 +3133,10 @@ void LLVMSetInstDebugLocation(LLVMBuilderRef Builder, LLVMValueRef Inst) { 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 index a93f9a0a571d..fe570f057c98 100644 --- a/llvm/tools/llvm-c-test/echo.cpp +++ b/llvm/tools/llvm-c-test/echo.cpp @@ -856,7 +856,7 @@ struct FunCloner { LLVMSetMetadata(Dst, Kind, LLVMMetadataAsValue(Ctx, MD)); } LLVMDisposeValueMetadataEntries(AllMetadata); - LLVMSetInstDebugLocation(Builder, Dst); + LLVMAddMetadataToInst(Builder, Dst); check_value_kind(Dst, LLVMInstructionValueKind); return VMap[Src] = Dst;