Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 1 | //===-- Status.cpp -----------------------------------------------*- C++ |
| 2 | //-*-===// |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 3 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 | // See https://llvm.org/LICENSE.txt for license information. |
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 10 | #include "lldb/Utility/Status.h" |
Zachary Turner | 4479ac1 | 2017-04-06 18:12:24 +0000 | [diff] [blame] | 11 | |
| 12 | #include "lldb/Utility/VASPrintf.h" |
Jonas Devlieghere | 672d2c1 | 2018-11-11 23:16:43 +0000 | [diff] [blame] | 13 | #include "lldb/lldb-defines.h" |
| 14 | #include "lldb/lldb-enumerations.h" |
| 15 | #include "llvm/ADT/SmallString.h" |
| 16 | #include "llvm/ADT/StringRef.h" |
Pavel Labath | 10c41f3 | 2017-06-06 14:06:17 +0000 | [diff] [blame] | 17 | #include "llvm/Support/Errno.h" |
Jonas Devlieghere | 672d2c1 | 2018-11-11 23:16:43 +0000 | [diff] [blame] | 18 | #include "llvm/Support/FormatProviders.h" |
Zachary Turner | 4479ac1 | 2017-04-06 18:12:24 +0000 | [diff] [blame] | 19 | |
| 20 | #include <cerrno> |
| 21 | #include <cstdarg> |
Jonas Devlieghere | 672d2c1 | 2018-11-11 23:16:43 +0000 | [diff] [blame] | 22 | #include <string> |
Zachary Turner | 4479ac1 | 2017-04-06 18:12:24 +0000 | [diff] [blame] | 23 | #include <system_error> |
| 24 | |
Charles Davis | 322fc84 | 2013-08-27 06:13:56 +0000 | [diff] [blame] | 25 | #ifdef __APPLE__ |
Charles Davis | 510938e | 2013-08-27 05:04:57 +0000 | [diff] [blame] | 26 | #include <mach/mach.h> |
Charles Davis | 322fc84 | 2013-08-27 06:13:56 +0000 | [diff] [blame] | 27 | #endif |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 28 | |
Aaron Smith | c3d447f | 2018-10-19 18:58:24 +0000 | [diff] [blame] | 29 | #ifdef _WIN32 |
| 30 | #include <windows.h> |
| 31 | #endif |
Jonas Devlieghere | 672d2c1 | 2018-11-11 23:16:43 +0000 | [diff] [blame] | 32 | #include <stdint.h> |
Eugene Zelenko | a74f37a | 2016-03-10 23:57:12 +0000 | [diff] [blame] | 33 | |
Zachary Turner | 4479ac1 | 2017-04-06 18:12:24 +0000 | [diff] [blame] | 34 | namespace llvm { |
| 35 | class raw_ostream; |
| 36 | } |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 37 | |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 38 | using namespace lldb; |
| 39 | using namespace lldb_private; |
| 40 | |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 41 | Status::Status() : m_code(0), m_type(eErrorTypeInvalid), m_string() {} |
Greg Clayton | ca512b3 | 2011-01-14 04:54:56 +0000 | [diff] [blame] | 42 | |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 43 | Status::Status(ValueType err, ErrorType type) |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 44 | : m_code(err), m_type(type), m_string() {} |
Greg Clayton | ca512b3 | 2011-01-14 04:54:56 +0000 | [diff] [blame] | 45 | |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 46 | Status::Status(std::error_code EC) |
Zachary Turner | 7d86ee5 | 2017-03-08 17:56:08 +0000 | [diff] [blame] | 47 | : m_code(EC.value()), m_type(ErrorType::eErrorTypeGeneric), |
| 48 | m_string(EC.message()) {} |
| 49 | |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 50 | Status::Status(const char *format, ...) |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 51 | : m_code(0), m_type(eErrorTypeInvalid), m_string() { |
| 52 | va_list args; |
| 53 | va_start(args, format); |
| 54 | SetErrorToGenericError(); |
| 55 | SetErrorStringWithVarArg(format, args); |
| 56 | va_end(args); |
Enrico Granata | f2bbf71 | 2011-07-15 02:26:42 +0000 | [diff] [blame] | 57 | } |
| 58 | |
Pavel Labath | 3adc408 | 2017-06-15 11:23:26 +0000 | [diff] [blame] | 59 | const Status &Status::operator=(llvm::Error error) { |
| 60 | if (!error) { |
| 61 | Clear(); |
| 62 | return *this; |
| 63 | } |
Pavel Labath | a24a3a3 | 2017-05-18 12:46:50 +0000 | [diff] [blame] | 64 | |
| 65 | // if the error happens to be a errno error, preserve the error code |
| 66 | error = llvm::handleErrors( |
| 67 | std::move(error), [&](std::unique_ptr<llvm::ECError> e) -> llvm::Error { |
| 68 | std::error_code ec = e->convertToErrorCode(); |
| 69 | if (ec.category() == std::generic_category()) { |
| 70 | m_code = ec.value(); |
| 71 | m_type = ErrorType::eErrorTypePOSIX; |
| 72 | return llvm::Error::success(); |
| 73 | } |
| 74 | return llvm::Error(std::move(e)); |
| 75 | }); |
| 76 | |
| 77 | // Otherwise, just preserve the message |
Pavel Labath | 3adc408 | 2017-06-15 11:23:26 +0000 | [diff] [blame] | 78 | if (error) { |
| 79 | SetErrorToGenericError(); |
Pavel Labath | a24a3a3 | 2017-05-18 12:46:50 +0000 | [diff] [blame] | 80 | SetErrorString(llvm::toString(std::move(error))); |
Pavel Labath | 3adc408 | 2017-06-15 11:23:26 +0000 | [diff] [blame] | 81 | } |
| 82 | |
| 83 | return *this; |
Pavel Labath | a24a3a3 | 2017-05-18 12:46:50 +0000 | [diff] [blame] | 84 | } |
| 85 | |
| 86 | llvm::Error Status::ToError() const { |
| 87 | if (Success()) |
| 88 | return llvm::Error::success(); |
| 89 | if (m_type == ErrorType::eErrorTypePOSIX) |
Aaron Smith | c3d447f | 2018-10-19 18:58:24 +0000 | [diff] [blame] | 90 | return llvm::errorCodeToError( |
| 91 | std::error_code(m_code, std::generic_category())); |
Pavel Labath | a24a3a3 | 2017-05-18 12:46:50 +0000 | [diff] [blame] | 92 | return llvm::make_error<llvm::StringError>(AsCString(), |
| 93 | llvm::inconvertibleErrorCode()); |
| 94 | } |
| 95 | |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 96 | Status::~Status() = default; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 97 | |
Aaron Smith | c3d447f | 2018-10-19 18:58:24 +0000 | [diff] [blame] | 98 | #ifdef _WIN32 |
| 99 | static std::string RetrieveWin32ErrorString(uint32_t error_code) { |
| 100 | char *buffer = nullptr; |
| 101 | std::string message; |
| 102 | // Retrieve win32 system error. |
| 103 | if (::FormatMessageA( |
| 104 | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | |
| 105 | FORMAT_MESSAGE_MAX_WIDTH_MASK, |
| 106 | NULL, error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), |
| 107 | (LPSTR)&buffer, 0, NULL)) { |
| 108 | message.assign(buffer); |
| 109 | ::LocalFree(buffer); |
| 110 | } |
| 111 | return message; |
| 112 | } |
| 113 | #endif |
| 114 | |
Adrian Prantl | 0509724 | 2018-04-30 16:49:04 +0000 | [diff] [blame] | 115 | // Get the error value as a NULL C string. The error string will be fetched and |
| 116 | // cached on demand. The cached error string value will remain until the error |
| 117 | // value is changed or cleared. |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 118 | const char *Status::AsCString(const char *default_error_str) const { |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 119 | if (Success()) |
| 120 | return nullptr; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 121 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 122 | if (m_string.empty()) { |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 123 | switch (m_type) { |
| 124 | case eErrorTypeMachKernel: |
| 125 | #if defined(__APPLE__) |
Pavel Labath | 10c41f3 | 2017-06-06 14:06:17 +0000 | [diff] [blame] | 126 | if (const char *s = ::mach_error_string(m_code)) |
| 127 | m_string.assign(s); |
Eli Friedman | 6eb685c | 2010-06-10 23:45:58 +0000 | [diff] [blame] | 128 | #endif |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 129 | break; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 130 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 131 | case eErrorTypePOSIX: |
Pavel Labath | 10c41f3 | 2017-06-06 14:06:17 +0000 | [diff] [blame] | 132 | m_string = llvm::sys::StrError(m_code); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 133 | break; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 134 | |
Aaron Smith | c3d447f | 2018-10-19 18:58:24 +0000 | [diff] [blame] | 135 | case eErrorTypeWin32: |
| 136 | #if defined(_WIN32) |
| 137 | m_string = RetrieveWin32ErrorString(m_code); |
| 138 | #endif |
| 139 | break; |
| 140 | |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 141 | default: |
| 142 | break; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 143 | } |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 144 | } |
| 145 | if (m_string.empty()) { |
| 146 | if (default_error_str) |
| 147 | m_string.assign(default_error_str); |
| 148 | else |
| 149 | return nullptr; // User wanted a nullptr string back... |
| 150 | } |
| 151 | return m_string.c_str(); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 152 | } |
| 153 | |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 154 | // Clear the error and any cached error string that it might contain. |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 155 | void Status::Clear() { |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 156 | m_code = 0; |
| 157 | m_type = eErrorTypeInvalid; |
| 158 | m_string.clear(); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 159 | } |
| 160 | |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 161 | // Access the error value. |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 162 | Status::ValueType Status::GetError() const { return m_code; } |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 163 | |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 164 | // Access the error type. |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 165 | ErrorType Status::GetType() const { return m_type; } |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 166 | |
Adrian Prantl | 0509724 | 2018-04-30 16:49:04 +0000 | [diff] [blame] | 167 | // Returns true if this object contains a value that describes an error or |
| 168 | // otherwise non-success result. |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 169 | bool Status::Fail() const { return m_code != 0; } |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 170 | |
Bruce Mitchener | 4ebdee0 | 2018-05-29 09:10:46 +0000 | [diff] [blame] | 171 | // Set accessor for the error value to "err" and the type to |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 172 | // "eErrorTypeMachKernel" |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 173 | void Status::SetMachError(uint32_t err) { |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 174 | m_code = err; |
| 175 | m_type = eErrorTypeMachKernel; |
| 176 | m_string.clear(); |
| 177 | } |
| 178 | |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 179 | void Status::SetExpressionError(lldb::ExpressionResults result, |
| 180 | const char *mssg) { |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 181 | m_code = result; |
| 182 | m_type = eErrorTypeExpression; |
| 183 | m_string = mssg; |
| 184 | } |
| 185 | |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 186 | int Status::SetExpressionErrorWithFormat(lldb::ExpressionResults result, |
| 187 | const char *format, ...) { |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 188 | int length = 0; |
| 189 | |
| 190 | if (format != nullptr && format[0]) { |
| 191 | va_list args; |
| 192 | va_start(args, format); |
| 193 | length = SetErrorStringWithVarArg(format, args); |
| 194 | va_end(args); |
| 195 | } else { |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 196 | m_string.clear(); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 197 | } |
| 198 | m_code = result; |
| 199 | m_type = eErrorTypeExpression; |
| 200 | return length; |
Jim Ingham | 1624a2d | 2014-05-05 02:26:40 +0000 | [diff] [blame] | 201 | } |
| 202 | |
Bruce Mitchener | 4ebdee0 | 2018-05-29 09:10:46 +0000 | [diff] [blame] | 203 | // Set accessor for the error value and type. |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 204 | void Status::SetError(ValueType err, ErrorType type) { |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 205 | m_code = err; |
| 206 | m_type = type; |
| 207 | m_string.clear(); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 208 | } |
| 209 | |
Adrian Prantl | 0509724 | 2018-04-30 16:49:04 +0000 | [diff] [blame] | 210 | // Update the error value to be "errno" and update the type to be "POSIX". |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 211 | void Status::SetErrorToErrno() { |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 212 | m_code = errno; |
| 213 | m_type = eErrorTypePOSIX; |
| 214 | m_string.clear(); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 215 | } |
| 216 | |
Adrian Prantl | 0509724 | 2018-04-30 16:49:04 +0000 | [diff] [blame] | 217 | // Update the error value to be LLDB_GENERIC_ERROR and update the type to be |
| 218 | // "Generic". |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 219 | void Status::SetErrorToGenericError() { |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 220 | m_code = LLDB_GENERIC_ERROR; |
| 221 | m_type = eErrorTypeGeneric; |
| 222 | m_string.clear(); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 223 | } |
| 224 | |
Adrian Prantl | 0509724 | 2018-04-30 16:49:04 +0000 | [diff] [blame] | 225 | // Set accessor for the error string value for a specific error. This allows |
| 226 | // any string to be supplied as an error explanation. The error string value |
| 227 | // will remain until the error value is cleared or a new error value/type is |
| 228 | // assigned. |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 229 | void Status::SetErrorString(llvm::StringRef err_str) { |
Zachary Turner | c156427 | 2016-11-16 21:15:24 +0000 | [diff] [blame] | 230 | if (!err_str.empty()) { |
Adrian Prantl | 0509724 | 2018-04-30 16:49:04 +0000 | [diff] [blame] | 231 | // If we have an error string, we should always at least have an error set |
| 232 | // to a generic value. |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 233 | if (Success()) |
| 234 | SetErrorToGenericError(); |
Zachary Turner | c156427 | 2016-11-16 21:15:24 +0000 | [diff] [blame] | 235 | } |
| 236 | m_string = err_str; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 237 | } |
| 238 | |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 239 | /// Set the current error string to a formatted error string. |
| 240 | /// |
Adrian Prantl | f05b42e | 2019-03-11 17:09:29 +0000 | [diff] [blame] | 241 | /// \param format |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 242 | /// A printf style format string |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 243 | int Status::SetErrorStringWithFormat(const char *format, ...) { |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 244 | if (format != nullptr && format[0]) { |
| 245 | va_list args; |
| 246 | va_start(args, format); |
| 247 | int length = SetErrorStringWithVarArg(format, args); |
| 248 | va_end(args); |
| 249 | return length; |
| 250 | } else { |
| 251 | m_string.clear(); |
| 252 | } |
| 253 | return 0; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 254 | } |
| 255 | |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 256 | int Status::SetErrorStringWithVarArg(const char *format, va_list args) { |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 257 | if (format != nullptr && format[0]) { |
Adrian Prantl | 0509724 | 2018-04-30 16:49:04 +0000 | [diff] [blame] | 258 | // If we have an error string, we should always at least have an error set |
| 259 | // to a generic value. |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 260 | if (Success()) |
| 261 | SetErrorToGenericError(); |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 262 | |
Zachary Turner | 24ae629 | 2017-02-16 19:38:21 +0000 | [diff] [blame] | 263 | llvm::SmallString<1024> buf; |
| 264 | VASprintf(buf, format, args); |
Pavel Labath | a272fa8 | 2017-02-17 10:19:46 +0000 | [diff] [blame] | 265 | m_string = buf.str(); |
Zachary Turner | 24ae629 | 2017-02-16 19:38:21 +0000 | [diff] [blame] | 266 | return buf.size(); |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 267 | } else { |
| 268 | m_string.clear(); |
| 269 | } |
| 270 | return 0; |
Chris Lattner | 30fdc8d | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 271 | } |
| 272 | |
Adrian Prantl | 0509724 | 2018-04-30 16:49:04 +0000 | [diff] [blame] | 273 | // Returns true if the error code in this object is considered a successful |
| 274 | // return value. |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 275 | bool Status::Success() const { return m_code == 0; } |
Jim Ingham | 4e5c821 | 2013-06-07 22:09:53 +0000 | [diff] [blame] | 276 | |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 277 | bool Status::WasInterrupted() const { |
Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 278 | return (m_type == eErrorTypePOSIX && m_code == EINTR); |
Jim Ingham | 4e5c821 | 2013-06-07 22:09:53 +0000 | [diff] [blame] | 279 | } |
Zachary Turner | 33aba3c | 2017-02-06 18:31:44 +0000 | [diff] [blame] | 280 | |
Zachary Turner | 97206d5 | 2017-05-12 04:51:55 +0000 | [diff] [blame] | 281 | void llvm::format_provider<lldb_private::Status>::format( |
| 282 | const lldb_private::Status &error, llvm::raw_ostream &OS, |
Zachary Turner | 33aba3c | 2017-02-06 18:31:44 +0000 | [diff] [blame] | 283 | llvm::StringRef Options) { |
| 284 | llvm::format_provider<llvm::StringRef>::format(error.AsCString(), OS, |
| 285 | Options); |
| 286 | } |