From fe63db25bcc0dd31fc471f60591a0f24ee8dbf57 Mon Sep 17 00:00:00 2001 From: David Spickett Date: Wed, 23 Jun 2021 11:28:16 +0000 Subject: [PATCH] [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 --- lldb/source/Interpreter/CommandReturnObject.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lldb/source/Interpreter/CommandReturnObject.cpp b/lldb/source/Interpreter/CommandReturnObject.cpp index 85cfd9a..506b0d6 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)); } -- 2.7.4