[Lldb-commits] [lldb] fe63db2 - [lldb] Remove asserts in CommandReturnObject SetError and AppendError

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 23 06:11:19 PDT 2021


Author: David Spickett
Date: 2021-06-23T13:11:14Z
New Revision: fe63db25bcc0dd31fc471f60591a0f24ee8dbf57

URL: https://github.com/llvm/llvm-project/commit/fe63db25bcc0dd31fc471f60591a0f24ee8dbf57
DIFF: https://github.com/llvm/llvm-project/commit/fe63db25bcc0dd31fc471f60591a0f24ee8dbf57.diff

LOG: [lldb] Remove asserts in CommandReturnObject SetError and AppendError

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.

Reviewed By: teemperor

Differential Revision: https://reviews.llvm.org/D104778

Added: 
    

Modified: 
    lldb/source/Interpreter/CommandReturnObject.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Interpreter/CommandReturnObject.cpp b/lldb/source/Interpreter/CommandReturnObject.cpp
index 85cfd9ab5cf5..506b0d6e7cde 100644
--- a/lldb/source/Interpreter/CommandReturnObject.cpp
+++ b/lldb/source/Interpreter/CommandReturnObject.cpp
@@ -99,13 +99,13 @@ void CommandReturnObject::AppendWarning(llvm::StringRef in_string) {
 
 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));
 }
 


        


More information about the lldb-commits mailing list