Skip to content

[Cherry-pick into stable/20230725] Avoid a potential exit(1) in LLVMContext::diagnose() (#84992) #8392

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions lldb/source/Expression/IRExecutionUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,18 +233,17 @@ struct IRExecDiagnosticHandler : public llvm::DiagnosticHandler {
Status *err;
IRExecDiagnosticHandler(Status *err) : err(err) {}
bool handleDiagnostics(const llvm::DiagnosticInfo &DI) override {
if (DI.getKind() == llvm::DK_SrcMgr) {
if (DI.getSeverity() == llvm::DS_Error) {
const auto &DISM = llvm::cast<llvm::DiagnosticInfoSrcMgr>(DI);
if (err && err->Success()) {
err->SetErrorToGenericError();
err->SetErrorStringWithFormat(
"Inline assembly error: %s",
"IRExecution error: %s",
DISM.getSMDiag().getMessage().str().c_str());
}
return true;
}

return false;
return true;
}
};
} // namespace
Expand Down