summaryrefslogtreecommitdiffstats
path: root/llvm/examples/Kaleidoscope
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/examples/Kaleidoscope')
-rw-r--r--llvm/examples/Kaleidoscope/Chapter4/toy.cpp6
-rw-r--r--llvm/examples/Kaleidoscope/Chapter5/toy.cpp6
-rw-r--r--llvm/examples/Kaleidoscope/Chapter6/toy.cpp6
-rw-r--r--llvm/examples/Kaleidoscope/Chapter7/toy.cpp6
4 files changed, 16 insertions, 8 deletions
diff --git a/llvm/examples/Kaleidoscope/Chapter4/toy.cpp b/llvm/examples/Kaleidoscope/Chapter4/toy.cpp
index a8f59428c0d..ff352f56ad0 100644
--- a/llvm/examples/Kaleidoscope/Chapter4/toy.cpp
+++ b/llvm/examples/Kaleidoscope/Chapter4/toy.cpp
@@ -572,11 +572,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);
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);
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);
diff --git a/llvm/examples/Kaleidoscope/Chapter7/toy.cpp b/llvm/examples/Kaleidoscope/Chapter7/toy.cpp
index c2c337c9008..89e8368a14d 100644
--- a/llvm/examples/Kaleidoscope/Chapter7/toy.cpp
+++ b/llvm/examples/Kaleidoscope/Chapter7/toy.cpp
@@ -1099,11 +1099,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