[Lldb-commits] [PATCH] D104380: [lldb] Set return object failed status even if error string is empty
David Spickett via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Jun 16 06:44:34 PDT 2021
DavidSpickett created this revision.
DavidSpickett requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
The idea is now that AppendError<...> will set eReturnStatusFailed
for you so you don't have to call SetStatus again.
Previously if the error message was empty, the status wouldn't
be set.
I don't think there are any sitautions where the message is in
fact empty but it potentially could be depending on where
we get the string from.
So let's set the status up front then return early if the message is empty.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D104380
Files:
lldb/source/Interpreter/CommandReturnObject.cpp
Index: lldb/source/Interpreter/CommandReturnObject.cpp
===================================================================
--- lldb/source/Interpreter/CommandReturnObject.cpp
+++ lldb/source/Interpreter/CommandReturnObject.cpp
@@ -98,9 +98,9 @@
}
void CommandReturnObject::AppendError(llvm::StringRef in_string) {
+ SetStatus(eReturnStatusFailed);
if (in_string.empty())
return;
- SetStatus(eReturnStatusFailed);
error(GetErrorStream()) << in_string.rtrim() << '\n';
}
@@ -113,6 +113,7 @@
}
void CommandReturnObject::SetError(llvm::StringRef error_str) {
+ SetStatus(eReturnStatusFailed);
if (error_str.empty())
return;
@@ -123,10 +124,10 @@
// append "\n" to the end of it.
void CommandReturnObject::AppendRawError(llvm::StringRef in_string) {
+ SetStatus(eReturnStatusFailed);
if (in_string.empty())
return;
GetErrorStream() << in_string;
- SetStatus(eReturnStatusFailed);
}
void CommandReturnObject::SetStatus(ReturnStatus status) { m_status = status; }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104380.352421.patch
Type: text/x-patch
Size: 1013 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210616/067a430f/attachment.bin>
More information about the lldb-commits
mailing list