Skip to content

Commit c3eccf0

Browse files
Avoid a potential exit(1) in LLVMContext::diagnose() (#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.
1 parent bb82092 commit c3eccf0

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
@@ -212,18 +212,17 @@ struct IRExecDiagnosticHandler : public llvm::DiagnosticHandler {
212212
Status *err;
213213
IRExecDiagnosticHandler(Status *err) : err(err) {}
214214
bool handleDiagnostics(const llvm::DiagnosticInfo &DI) override {
215-
if (DI.getKind() == llvm::DK_SrcMgr) {
215+
if (DI.getSeverity() == llvm::DS_Error) {
216216
const auto &DISM = llvm::cast<llvm::DiagnosticInfoSrcMgr>(DI);
217217
if (err && err->Success()) {
218218
err->SetErrorToGenericError();
219219
err->SetErrorStringWithFormat(
220-
"Inline assembly error: %s",
220+
"IRExecution error: %s",
221221
DISM.getSMDiag().getMessage().str().c_str());
222222
}
223-
return true;
224223
}
225224

226-
return false;
225+
return true;
227226
}
228227
};
229228
} // namespace

0 commit comments

Comments
 (0)