Return 0 if we cannot find an address.

Add an llvm_unreachable to handle potential errors.
This commit is contained in:
Vassil Vassilev 2017-10-21 19:02:01 +02:00 committed by sftnight
parent 5f3494f950
commit d6fe62edaf

View File

@ -190,11 +190,14 @@ public:
// FIXME: We should decide if we want to handle the error here or make the
// return type of the function llvm::Expected<uint64_t> relying on the
// users to decide how to handle the error.
if (auto Sym = getSymbolAddressWithoutMangling(Mangle(Name), AlsoInProcess))
if (auto AddrOrErr = Sym.getAddress())
if (auto S = getSymbolAddressWithoutMangling(Mangle(Name), AlsoInProcess)) {
if (auto AddrOrErr = S.getAddress())
return *AddrOrErr;
else
llvm_unreachable("Handle the error case");
}
return ~0U;
return 0;
}
///\brief Get the address of a symbol from the JIT or the memory manager.