Skip to content

Commit bbae398

Browse files
committed
Avoid a potential exit(1) in LLVMContext::diagnose() (llvm#84992)
by handling *all* errors in IRExecDiagnosticHandler. The function that call this handles all unhandled errors with an `exit(1)`. rdar://124459751 I don't really have a testcase for this, since the crash report I got for this involved the Swift language plugin. (cherry picked from commit c3eccf0)
1 parent 7ddff01 commit bbae398

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lldb/source/Expression/IRExecutionUnit.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,18 +233,17 @@ struct IRExecDiagnosticHandler : public llvm::DiagnosticHandler {
233233
Status *err;
234234
IRExecDiagnosticHandler(Status *err) : err(err) {}
235235
bool handleDiagnostics(const llvm::DiagnosticInfo &DI) override {
236-
if (DI.getKind() == llvm::DK_SrcMgr) {
236+
if (DI.getSeverity() == llvm::DS_Error) {
237237
const auto &DISM = llvm::cast<llvm::DiagnosticInfoSrcMgr>(DI);
238238
if (err && err->Success()) {
239239
err->SetErrorToGenericError();
240240
err->SetErrorStringWithFormat(
241-
"Inline assembly error: %s",
241+
"IRExecution error: %s",
242242
DISM.getSMDiag().getMessage().str().c_str());
243243
}
244-
return true;
245244
}
246245

247-
return false;
246+
return true;
248247
}
249248
};
250249
} // namespace

0 commit comments

Comments
 (0)