diff --git a/include/llvm-c/Orc.h b/include/llvm-c/Orc.h index 6271ab689c8..8c620fac967 100644 --- a/include/llvm-c/Orc.h +++ b/include/llvm-c/Orc.h @@ -192,7 +192,7 @@ LLVMErrorRef LLVMOrcCreateDynamicLibrarySearchGeneratorForProcess( * * Ownership of the underlying ThreadSafeContext data is shared: Clients * can and should dispose of their ThreadSafeContext as soon as they no longer - * need to refer to it directly. Other references (e.g. from ThreadSafeModules + * need to refer to it directly. Other references (e.g. from ThreadSafeModules) * will keep the data alive as long as it is needed. */ LLVMOrcThreadSafeContextRef LLVMOrcCreateNewThreadSafeContext(void); @@ -214,7 +214,7 @@ void LLVMOrcDisposeThreadSafeContext(LLVMOrcThreadSafeContextRef TSCtx); * after this function returns. * * Ownership of the ThreadSafeModule is unique: If it is transferred to the JIT - * (e.g. by LLVMOrcLLJITAddLLVMIRModule), in which case the client is no longer + * (e.g. by LLVMOrcLLJITAddLLVMIRModule) then the client is no longer * responsible for it. If it is not transferred to the JIT then the client * should call LLVMOrcDisposeThreadSafeModule to dispose of it. */ diff --git a/lib/ExecutionEngine/Orc/OrcV2CBindings.cpp b/lib/ExecutionEngine/Orc/OrcV2CBindings.cpp index 8588acf34fe..b0aa1cf5ca6 100644 --- a/lib/ExecutionEngine/Orc/OrcV2CBindings.cpp +++ b/lib/ExecutionEngine/Orc/OrcV2CBindings.cpp @@ -257,7 +257,8 @@ LLVMErrorRef LLVMOrcLLJITAddObjectFile(LLVMOrcLLJITRef J, LLVMOrcJITDylibRef JD, LLVMErrorRef LLVMOrcLLJITAddLLVMIRModule(LLVMOrcLLJITRef J, LLVMOrcJITDylibRef JD, LLVMOrcThreadSafeModuleRef TSM) { - return wrap(unwrap(J)->addIRModule(*unwrap(JD), std::move(*unwrap(TSM)))); + std::unique_ptr TmpTSM(unwrap(TSM)); + return wrap(unwrap(J)->addIRModule(*unwrap(JD), std::move(*TmpTSM))); } LLVMErrorRef LLVMOrcLLJITLookup(LLVMOrcLLJITRef J,