[Lldb-commits] [PATCH] D104778: [lldb] Remove asserts in CommandReturnObject SetError and AppendError

David Spickett via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 23 04:38:02 PDT 2021


DavidSpickett created this revision.
DavidSpickett requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

I added asserts to these in https://reviews.llvm.org/D104525.
They are available (directly or otherwise) via the API so we
should not assert.

Restore the previous behaviour. If the message
is empty, we return early before printing anything.
For SetError don't assert that the error is a failure.

The remaining assert is in AppendRawError which
is not part of the API.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104778

Files:
  lldb/source/Interpreter/CommandReturnObject.cpp


Index: lldb/source/Interpreter/CommandReturnObject.cpp
===================================================================
--- lldb/source/Interpreter/CommandReturnObject.cpp
+++ lldb/source/Interpreter/CommandReturnObject.cpp
@@ -99,13 +99,13 @@
 
 void CommandReturnObject::AppendError(llvm::StringRef in_string) {
   SetStatus(eReturnStatusFailed);
-  assert(!in_string.empty() && "Expected a non-empty error message");
+  if (in_string.empty())
+    return;
   error(GetErrorStream()) << in_string.rtrim() << '\n';
 }
 
 void CommandReturnObject::SetError(const Status &error,
                                    const char *fallback_error_cstr) {
-  assert(error.Fail() && "Expected a failed Status");
   AppendError(error.AsCString(fallback_error_cstr));
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104778.353929.patch
Type: text/x-patch
Size: 766 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210623/ee07c30d/attachment.bin>


More information about the lldb-commits mailing list