diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-08-19 04:04:25 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-08-19 04:04:25 +0000 |
commit | 2a8a2795ee8edb8120d10c3c2af397f429b13c57 (patch) | |
tree | f77e8ceaf358640f215dc0207854cb9d00975e08 /llvm/examples/BrainF/BrainFDriver.cpp | |
parent | 687744d0114c46529def899ee6c67428cbdf3d92 (diff) | |
download | bcm5719-llvm-2a8a2795ee8edb8120d10c3c2af397f429b13c57.tar.gz bcm5719-llvm-2a8a2795ee8edb8120d10c3c2af397f429b13c57.zip |
Make it explicit that ExecutionEngine takes ownership of the modules.
llvm-svn: 215967
Diffstat (limited to 'llvm/examples/BrainF/BrainFDriver.cpp')
-rw-r--r-- | llvm/examples/BrainF/BrainFDriver.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/llvm/examples/BrainF/BrainFDriver.cpp b/llvm/examples/BrainF/BrainFDriver.cpp index e2de6bc58d7..9b1f0d3f118 100644 --- a/llvm/examples/BrainF/BrainFDriver.cpp +++ b/llvm/examples/BrainF/BrainFDriver.cpp @@ -125,13 +125,13 @@ int main(int argc, char **argv) { //Read the BrainF program BrainF bf; - Module *mod = bf.parse(in, 65536, cf, Context); //64 KiB + std::unique_ptr<Module> Mod(bf.parse(in, 65536, cf, Context)); // 64 KiB if (in != &std::cin) delete in; - addMainFunction(mod); + addMainFunction(Mod.get()); //Verify generated code - if (verifyModule(*mod)) { + if (verifyModule(*Mod)) { errs() << "Error: module failed verification. This shouldn't happen.\n"; abort(); } @@ -141,18 +141,18 @@ int main(int argc, char **argv) { InitializeNativeTarget(); outs() << "------- Running JIT -------\n"; - ExecutionEngine *ee = EngineBuilder(mod).create(); + Module &M = *Mod; + ExecutionEngine *ee = EngineBuilder(std::move(Mod)).create(); std::vector<GenericValue> args; - Function *brainf_func = mod->getFunction("brainf"); + Function *brainf_func = M.getFunction("brainf"); GenericValue gv = ee->runFunction(brainf_func, args); } else { - WriteBitcodeToFile(mod, *out); + WriteBitcodeToFile(Mod.get(), *out); } //Clean up if (out != &outs()) delete out; - delete mod; llvm_shutdown(); |