summaryrefslogtreecommitdiffstats
path: root/llvm/tools/lli/lli.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/lli/lli.cpp')
-rw-r--r--llvm/tools/lli/lli.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp
index 0f30a4a5ff0..ce99b6ac7a0 100644
--- a/llvm/tools/lli/lli.cpp
+++ b/llvm/tools/lli/lli.cpp
@@ -582,7 +582,7 @@ int main(int argc, char **argv, char * const *envp) {
// Reset errno to zero on entry to main.
errno = 0;
- int Result;
+ int Result = -1;
// Sanity check use of remote-jit: LLI currently only supports use of the
// remote JIT on Unix platforms.
@@ -681,12 +681,13 @@ int main(int argc, char **argv, char * const *envp) {
static_cast<ForwardingMemoryManager*>(RTDyldMM)->setResolver(
orc::createLambdaResolver(
[&](const std::string &Name) {
- orc::TargetAddress Addr = 0;
- if (auto EC = R->getSymbolAddress(Addr, Name)) {
- errs() << "Failure during symbol lookup: " << EC.message() << "\n";
- exit(1);
- }
- return RuntimeDyld::SymbolInfo(Addr, JITSymbolFlags::Exported);
+ if (auto AddrOrErr = R->getSymbolAddress(Name))
+ return RuntimeDyld::SymbolInfo(*AddrOrErr, JITSymbolFlags::Exported);
+ else {
+ errs() << "Failure during symbol lookup: "
+ << AddrOrErr.getError().message() << "\n";
+ exit(1);
+ }
},
[](const std::string &Name) { return nullptr; }
));
@@ -698,8 +699,10 @@ int main(int argc, char **argv, char * const *envp) {
EE->finalizeObject();
DEBUG(dbgs() << "Executing '" << EntryFn->getName() << "' at 0x"
<< format("%llx", Entry) << "\n");
- if (auto EC = R->callIntVoid(Result, Entry))
- errs() << "ERROR: " << EC.message() << "\n";
+ if (auto ResultOrErr = R->callIntVoid(Entry))
+ Result = *ResultOrErr;
+ else
+ errs() << "ERROR: " << ResultOrErr.getError().message() << "\n";
// Like static constructors, the remote target MCJIT support doesn't handle
// this yet. It could. FIXME.
OpenPOWER on IntegriCloud