diff options
| author | Adrian Prantl <adrian-prantl@users.noreply.github.com> | 2024-03-13 08:53:13 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-13 08:53:13 -0700 |
| commit | c3eccf03b365a705bc8dc043217478a82bc37a4d (patch) | |
| tree | bfe0e3ae98b92cca5f7888501138a1558c72f69e /lldb/source/Expression/IRExecutionUnit.cpp | |
| parent | bb82092de71466728630050691fa9c20796b3cbc (diff) | |
| download | llvm-c3eccf03b365a705bc8dc043217478a82bc37a4d.tar.gz llvm-c3eccf03b365a705bc8dc043217478a82bc37a4d.tar.bz2 llvm-c3eccf03b365a705bc8dc043217478a82bc37a4d.zip | |
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.
Diffstat (limited to 'lldb/source/Expression/IRExecutionUnit.cpp')
| -rw-r--r-- | lldb/source/Expression/IRExecutionUnit.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lldb/source/Expression/IRExecutionUnit.cpp b/lldb/source/Expression/IRExecutionUnit.cpp index e4e131d70d43..cb9bee8733e1 100644 --- a/lldb/source/Expression/IRExecutionUnit.cpp +++ b/lldb/source/Expression/IRExecutionUnit.cpp @@ -212,18 +212,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 |
