Skip to content

Commit

Permalink
rustllvm: fix wrapper builds with LLVM 3.5
Browse files Browse the repository at this point in the history
EngineBuilder signature has changed in LLVM 3.6, as the interface
was not move-based in previous releases.

Signed-off-by: Luca Bruno <[email protected]>
  • Loading branch information
lucab committed Jan 26, 2015
1 parent 88f8f52 commit 18f8d35
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/rustllvm/ExecutionEngineWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ extern "C" LLVMExecutionEngineRef LLVMBuildExecutionEngine(
InitializeNativeTargetAsmPrinter();
InitializeNativeTargetAsmParser();

std::unique_ptr<Module> m(unwrap(mod));
RustJITMemoryManager *mm = unwrap(mref);

std::string error_str;
Expand All @@ -91,12 +90,22 @@ extern "C" LLVMExecutionEngineRef LLVMBuildExecutionEngine(
options.JITEmitDebugInfo = true;
options.NoFramePointerElim = true;

#if LLVM_VERSION_MINOR > 5
std::unique_ptr<Module> m(unwrap(mod));
ExecutionEngine *ee = EngineBuilder(std::move(m))
.setEngineKind(EngineKind::JIT)
.setErrorStr(&error_str)
.setMCJITMemoryManager(mm)
.setTargetOptions(options)
.create();
#else
ExecutionEngine *ee = EngineBuilder(unwrap(mod))
.setEngineKind(EngineKind::JIT)
.setErrorStr(&error_str)
.setMCJITMemoryManager(mm)
.setTargetOptions(options)
.create();
#endif

if (!ee)
LLVMRustSetLastError(error_str.c_str());
Expand Down

0 comments on commit 18f8d35

Please sign in to comment.