Skip to content

Commit

Permalink
Handle Error in addOrReplaceDefinition
Browse files Browse the repository at this point in the history
The only acceptable error is that the symbol cannot be found, in
which case we try to replace it in the next Dylib, or else just add
it to the main Dylib.

Fixes commit 6ab0c926f7 ("[cling] Replace symbols in platform Dylib")
  • Loading branch information
hahnjo authored and jenkins committed Dec 3, 2024
1 parent f55adaf commit 82c2dfc
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/Interpreter/IncrementalJIT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,19 @@ IncrementalJIT::addOrReplaceDefinition(StringRef Name,
bool Defined = false;
for (auto* Dylib :
{&Jit->getMainJITDylib(), Jit->getPlatformJITDylib().get()}) {
if (Dylib->remove({It->first})) {
if (Error Err = Dylib->remove({It->first})) {
Err = handleErrors(std::move(Err),
[&](std::unique_ptr<SymbolsNotFound> Err) -> Error {
// This is fine, we will try in the next Dylib.
return Error::success();
});

if (Err) {
logAllUnhandledErrors(std::move(Err), errs(),
"[IncrementalJIT] remove() failed: ");
return orc::ExecutorAddr();
}

continue;
}

Expand Down

0 comments on commit 82c2dfc

Please sign in to comment.