This patch adds a new convience constructor to the SBError to initialize
it with a string message to avoid having to create the object and call
the `SetErrorString` method afterwards.
This is very handy to report errors from lldb scripted affordances.
Differential Revision: https://reviews.llvm.org/D148401
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
SBError(const lldb::SBError &rhs);
+ SBError(const char *message);
+
#ifndef SWIG
SBError(const lldb_private::Status &error);
#endif
m_opaque_up = clone(rhs.m_opaque_up);
}
+SBError::SBError(const char *message) {
+ LLDB_INSTRUMENT_VA(this, message);
+
+ SetErrorString(message);
+}
+
SBError::SBError(const lldb_private::Status &status)
: m_opaque_up(new Status(status)) {
LLDB_INSTRUMENT_VA(this, status);