Make it explicit that ExecutionEngine takes ownership of the modules.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215967 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2014-08-19 04:04:25 +00:00
parent 4d48c3f2a4
commit 3f4ed32b43
27 changed files with 242 additions and 223 deletions

View File

@ -96,15 +96,16 @@ int main(int argc, char **argv) {
LLVMContext Context;
// Create some module to put our function into it.
std::unique_ptr<Module> M(new Module("test", Context));
std::unique_ptr<Module> Owner(new Module("test", Context));
Module *M = Owner.get();
// We are about to create the "fib" function:
Function *FibF = CreateFibFunction(M.get(), Context);
Function *FibF = CreateFibFunction(M, Context);
// Now we going to create JIT
std::string errStr;
ExecutionEngine *EE =
EngineBuilder(M.get())
EngineBuilder(std::move(Owner))
.setErrorStr(&errStr)
.setEngineKind(EngineKind::JIT)
.create();