[Lldb-commits] [lldb] [lldb] Add Status::Detail to store expression evaluator diagnostics [… (PR #106442)

Adrian Prantl via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 28 16:55:20 PDT 2024


================
@@ -65,6 +65,23 @@ std::string DiagnosticManager::GetString(char separator) {
   return ret;
 }
 
+Status DiagnosticManager::GetAsStatus(lldb::ExpressionResults result) {
+  llvm::SmallVector<Status::Detail, 0> details;
+  details.reserve(m_diagnostics.size());
+  for (const auto &diagnostic : m_diagnostics)
+    details.push_back(diagnostic->GetDetail());
+  return Status::FromExpressionErrorDetails(result, std::move(details));
+}
+
+void DiagnosticManager::AddDiagnostic(llvm::StringRef message,
+                                      lldb::Severity severity,
+                                      DiagnosticOrigin origin,
+                                      uint32_t compiler_id) {
+  m_diagnostics.emplace_back(std::make_unique<Diagnostic>(
+      origin, compiler_id,
+      Status::Detail{{}, severity, message.str(), message.str()}));
----------------
adrian-prantl wrote:

Correct. For manual LLDB-originated diagnostics the two are identical. Generally the "rendered" version is a fallback that exists if the user interface cannot render the diagnostic itself. In the case of the expression evaluator the big difference is that the rendered version repeats the expressions string inside of the diagnostic.

https://github.com/llvm/llvm-project/pull/106442


More information about the lldb-commits mailing list