summaryrefslogtreecommitdiffstats
path: root/llvm/examples/Kaleidoscope/Chapter6/toy.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-08-19 04:04:25 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-08-19 04:04:25 +0000
commit2a8a2795ee8edb8120d10c3c2af397f429b13c57 (patch)
treef77e8ceaf358640f215dc0207854cb9d00975e08 /llvm/examples/Kaleidoscope/Chapter6/toy.cpp
parent687744d0114c46529def899ee6c67428cbdf3d92 (diff)
downloadbcm5719-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/Kaleidoscope/Chapter6/toy.cpp')
-rw-r--r--llvm/examples/Kaleidoscope/Chapter6/toy.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/examples/Kaleidoscope/Chapter6/toy.cpp b/llvm/examples/Kaleidoscope/Chapter6/toy.cpp
index 5a3bd2e3147..d782395fdaa 100644
--- a/llvm/examples/Kaleidoscope/Chapter6/toy.cpp
+++ b/llvm/examples/Kaleidoscope/Chapter6/toy.cpp
@@ -935,11 +935,13 @@ int main() {
getNextToken();
// Make the module, which holds all the code.
- TheModule = new Module("my cool jit", Context);
+ std::unique_ptr<Module> Owner = make_unique<Module>("my cool jit", Context);
+ TheModule = Owner.get();
// Create the JIT. This takes ownership of the module.
std::string ErrStr;
- TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&ErrStr).create();
+ TheExecutionEngine =
+ EngineBuilder(std::move(Owner)).setErrorStr(&ErrStr).create();
if (!TheExecutionEngine) {
fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
exit(1);
OpenPOWER on IntegriCloud