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

via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 3 11:14:54 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,
----------------
jimingham wrote:

This API seems wrong to me.  You have the CommandReturnObject being made up for some command that got executed, so I should know what that command was.  Then I have another API where I can pass in (if I feel like it) an entirely unrelated string as the "command".  Then I have some m_user_input which is some subset of what the user actually input for the command.
Maybe I'm missing something, but this is confusing to me.

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


More information about the lldb-commits mailing list