Skip to content

Commit 90bee58

Browse files
committed
[lldb] Add transitional backwards-compatible API to Status
1 parent 0d37503 commit 90bee58

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

lldb/include/lldb/Utility/Status.h

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,69 @@ class Status {
8383
return Status(result, lldb::eErrorTypeExpression, msg);
8484
}
8585

86+
////////////////////////////////////////////////////////////////////////////
87+
// TO BE REMOVED ASAP.
88+
// This is transitional to make it easier to iterate with broken bots.
89+
////////////////////////////////////////////////////////////////////////////
90+
LLVM_DEPRECATED("Use Status::FromErrorString() instead", "FromErrorString")
91+
explicit Status(const char *format, ...)
92+
__attribute__((format(printf, 2, 3))) {
93+
// Yes, this drops the arguments.
94+
*this = Status::FromErrorString(format);
95+
}
96+
template <typename... Args>
97+
static LLVM_DEPRECATED("Use Status::FromErrorStringWithFormat() instead",
98+
"FromErrorStringWithFormat") Status
99+
createWithFormat(const char *format, Args &&...args) {
100+
return Status::FromErrorStringWithFormat(format,
101+
std::forward<Args>(args)...);
102+
}
103+
LLVM_DEPRECATED("Use Status::FromExpressionError() instead",
104+
"FromExpressionError")
105+
void SetExpressionError(lldb::ExpressionResults results, const char *msg) {
106+
*this = Status::FromExpressionError(results, msg);
107+
}
108+
LLVM_DEPRECATED("Use Status::FromExpressionError() instead",
109+
"FromExpressionError")
110+
int SetExpressionErrorWithFormat(lldb::ExpressionResults results,
111+
const char *msg, ...) {
112+
*this = Status::FromExpressionError(results, msg);
113+
return 0;
114+
}
115+
LLVM_DEPRECATED("Use Status::Status() instead", "Status")
116+
void SetError(ValueType err, lldb::ErrorType type) {
117+
Status error(err, lldb::eErrorTypeGeneric);
118+
*this = error;
119+
}
120+
LLVM_DEPRECATED("Use Status::FromErrNo() instead", "Status")
121+
void SetErrorToErrno() { *this = Status::FromErrno(); }
122+
LLVM_DEPRECATED("Use Status() instead", "Status")
123+
void SetErrorToGenericError() {
124+
*this = Status::FromErrorString("generic error");
125+
}
126+
LLVM_DEPRECATED("Use Status::FromErrorString() instead", "Status")
127+
void SetErrorString(llvm::StringRef err_str) {
128+
*this = Status::FromErrorString(err_str.str().c_str());
129+
}
130+
LLVM_DEPRECATED("Use Status::FromErrorStringWithFormat() instead", "Status")
131+
int SetErrorStringWithFormat(const char *format, ...)
132+
__attribute__((format(printf, 2, 3))) {
133+
*this = Status::FromErrorString(format);
134+
return 0;
135+
}
136+
LLVM_DEPRECATED("Use Status::FromErrorString() instead", "Status")
137+
int SetErrorStringWithVarArg(const char *format, va_list args) {
138+
*this = Status::FromErrorString(format);
139+
return 0;
140+
}
141+
template <typename... Args>
142+
LLVM_DEPRECATED("Use Status::FromErrorStringWithFormatv() instead", "Status")
143+
void SetErrorStringWithFormatv(const char *format, Args &&...args) {
144+
*this =
145+
Status::FromErrorStringWithFormatv(format, std::forward<Args>(args)...);
146+
}
147+
////////////////////////////////////////////////////////////////////////////
148+
86149
/// Set the current error to errno.
87150
///
88151
/// Update the error value to be \c errno and update the type to be \c

0 commit comments

Comments
 (0)