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.
Reviewed By: teemperor
Differential Revision: https://reviews.llvm.org/D104380
}
void CommandReturnObject::AppendError(llvm::StringRef in_string) {
+ SetStatus(eReturnStatusFailed);
if (in_string.empty())
return;
- SetStatus(eReturnStatusFailed);
error(GetErrorStream()) << in_string.rtrim() << '\n';
}
}
void CommandReturnObject::SetError(llvm::StringRef error_str) {
+ SetStatus(eReturnStatusFailed);
if (error_str.empty())
return;
// 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; }