summaryrefslogtreecommitdiffstats
path: root/llvm/examples/Kaleidoscope/Chapter5/toy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/examples/Kaleidoscope/Chapter5/toy.cpp')
-rw-r--r--llvm/examples/Kaleidoscope/Chapter5/toy.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/examples/Kaleidoscope/Chapter5/toy.cpp b/llvm/examples/Kaleidoscope/Chapter5/toy.cpp
index a31b5b4792a..550504259ee 100644
--- a/llvm/examples/Kaleidoscope/Chapter5/toy.cpp
+++ b/llvm/examples/Kaleidoscope/Chapter5/toy.cpp
@@ -817,11 +817,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