Handle llvm::Errors correctly.

This fixes several tests on osx.
This commit is contained in:
Vassil Vassilev 2023-07-21 11:58:46 +00:00 committed by jenkins
parent 5cf51d53dd
commit 8069aa7a73
2 changed files with 9 additions and 3 deletions

View File

@ -1141,9 +1141,13 @@ namespace cling {
auto ObjF = llvm::object::ObjectFile::createObjectFile(FileName);
if (!ObjF) {
std::string Message;
handleAllErrors(ObjF.takeError(), [&](llvm::ErrorInfoBase &EIB) {
Message += EIB.message() + "; ";
});
if (DEBUG > 1)
cling::errs() << "[DyLD] Failed to read object file "
<< FileName << "\n";
<< FileName << ". Message: '" << Message << "\n";
return true;
}

View File

@ -425,8 +425,10 @@ public:
const SymbolLookupSet& LookupSet) override {
SymbolMap Symbols;
for (auto& KV : LookupSet) {
if (auto Addr = lookup(*KV.first))
Symbols[KV.first] = Addr.get();
auto Addr = lookup(*KV.first);
if (auto Err = Addr.takeError())
return Err;
Symbols[KV.first] = Addr.get();
}
if (Symbols.empty())
return Error::success();