[Lldb-commits] [lldb] Support inline diagnostics in CommandReturnObject (PR #110901)

Adrian Prantl via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 4 18:23:17 PDT 2024


================
@@ -112,8 +113,46 @@ void CommandReturnObject::SetError(Status error) {
 }
 
 void CommandReturnObject::SetError(llvm::Error error) {
-  if (error)
+  // Retrieve any diagnostics.
+  error = llvm::handleErrors(std::move(error), [&](ExpressionErrorBase &error) {
+    SetStatus(eReturnStatusFailed);
+    m_diagnostics = error.GetDetails();
+  });
+  if (error) {
     AppendError(llvm::toString(std::move(error)));
+  }
+}
+
+llvm::StringRef
+CommandReturnObject::GetInlineDiagnosticsData(unsigned indent,
----------------
adrian-prantl wrote:

Agreed. I made it slightly less weird by moving the indent computation into CommandInterpreter, but I still can't say I like it.

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


More information about the lldb-commits mailing list