diff --git a/include/llvm-c/Orc.h b/include/llvm-c/Orc.h index 78f6f28a465..76692ba89de 100644 --- a/include/llvm-c/Orc.h +++ b/include/llvm-c/Orc.h @@ -635,8 +635,9 @@ LLVMErrorRef LLVMOrcJITTargetMachineBuilderDetectHost( * * This operation takes ownership of the given TargetMachine and destroys it * before returing. The resulting JITTargetMachineBuilder is owned by the client - * and must be passed to a consuming operation (e.g. LLVMOrcCreateLLJITBuilder) - * or disposed of by calling LLVMOrcDisposeJITTargetMachineBuilder. + * and must be passed to a consuming operation (e.g. + * LLVMOrcLLJITBuilderSetJITTargetMachineBuilder) or disposed of by calling + * LLVMOrcDisposeJITTargetMachineBuilder. */ LLVMOrcJITTargetMachineBuilderRef LLVMOrcJITTargetMachineBuilderCreateFromTargetMachine(LLVMTargetMachineRef TM); diff --git a/lib/ExecutionEngine/Orc/OrcV2CBindings.cpp b/lib/ExecutionEngine/Orc/OrcV2CBindings.cpp index 419f6e81e6e..5f9cb10be58 100644 --- a/lib/ExecutionEngine/Orc/OrcV2CBindings.cpp +++ b/lib/ExecutionEngine/Orc/OrcV2CBindings.cpp @@ -513,7 +513,8 @@ void LLVMOrcDisposeLLJITBuilder(LLVMOrcLLJITBuilderRef Builder) { void LLVMOrcLLJITBuilderSetJITTargetMachineBuilder( LLVMOrcLLJITBuilderRef Builder, LLVMOrcJITTargetMachineBuilderRef JTMB) { - unwrap(Builder)->setJITTargetMachineBuilder(*unwrap(JTMB)); + unwrap(Builder)->setJITTargetMachineBuilder(std::move(*unwrap(JTMB))); + LLVMOrcDisposeJITTargetMachineBuilder(JTMB); } void LLVMOrcLLJITBuilderSetObjectLinkingLayerCreator(