diff options
| author | Lang Hames <lhames@gmail.com> | 2018-03-15 00:30:14 +0000 |
|---|---|---|
| committer | Lang Hames <lhames@gmail.com> | 2018-03-15 00:30:14 +0000 |
| commit | 5721ee48a2a8f9202a21936747090115c9abf584 (patch) | |
| tree | 7a49d8303b9cadb83667aa72d53d4b151ca1e414 /llvm/tools/lli/OrcLazyJIT.cpp | |
| parent | f4a0e9a78c46e9b59c6e549e465dfbbbd93475d9 (diff) | |
| download | bcm5719-llvm-5721ee48a2a8f9202a21936747090115c9abf584.tar.gz bcm5719-llvm-5721ee48a2a8f9202a21936747090115c9abf584.zip | |
[ORC] Re-apply r327566 with a fix for test-global-ctors.ll.
Also clang-formats the patch, which I should have done the first time around.
llvm-svn: 327594
Diffstat (limited to 'llvm/tools/lli/OrcLazyJIT.cpp')
| -rw-r--r-- | llvm/tools/lli/OrcLazyJIT.cpp | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/llvm/tools/lli/OrcLazyJIT.cpp b/llvm/tools/lli/OrcLazyJIT.cpp index f1a752e0790..a7f0e338b9c 100644 --- a/llvm/tools/lli/OrcLazyJIT.cpp +++ b/llvm/tools/lli/OrcLazyJIT.cpp @@ -54,10 +54,10 @@ static cl::opt<bool> OrcInlineStubs("orc-lazy-inline-stubs", OrcLazyJIT::TransformFtor OrcLazyJIT::createDebugDumper() { switch (OrcDumpKind) { case DumpKind::NoDump: - return [](std::shared_ptr<Module> M) { return M; }; + return [](std::unique_ptr<Module> M) { return M; }; case DumpKind::DumpFuncsToStdOut: - return [](std::shared_ptr<Module> M) { + return [](std::unique_ptr<Module> M) { printf("[ "); for (const auto &F : *M) { @@ -76,26 +76,25 @@ OrcLazyJIT::TransformFtor OrcLazyJIT::createDebugDumper() { }; case DumpKind::DumpModsToStdOut: - return [](std::shared_ptr<Module> M) { - outs() << "----- Module Start -----\n" << *M - << "----- Module End -----\n"; + return [](std::unique_ptr<Module> M) { + outs() << "----- Module Start -----\n" + << *M << "----- Module End -----\n"; - return M; - }; + return M; + }; case DumpKind::DumpModsToDisk: - return [](std::shared_ptr<Module> M) { - std::error_code EC; - raw_fd_ostream Out(M->getModuleIdentifier() + ".ll", EC, - sys::fs::F_Text); - if (EC) { - errs() << "Couldn't open " << M->getModuleIdentifier() - << " for dumping.\nError:" << EC.message() << "\n"; - exit(1); - } - Out << *M; - return M; - }; + return [](std::unique_ptr<Module> M) { + std::error_code EC; + raw_fd_ostream Out(M->getModuleIdentifier() + ".ll", EC, sys::fs::F_Text); + if (EC) { + errs() << "Couldn't open " << M->getModuleIdentifier() + << " for dumping.\nError:" << EC.message() << "\n"; + exit(1); + } + Out << *M; + return M; + }; } llvm_unreachable("Unknown DumpKind"); } @@ -148,7 +147,7 @@ int llvm::runOrcLazyJIT(std::vector<std::unique_ptr<Module>> Ms, // Add the module, look up main and run it. for (auto &M : Ms) - cantFail(J.addModule(std::shared_ptr<Module>(std::move(M)))); + cantFail(J.addModule(std::move(M))); if (auto MainSym = J.findSymbol("main")) { typedef int (*MainFnPtr)(int, const char*[]); |

