9#ifndef LLDB_UTILITY_STATUS_H
10#define LLDB_UTILITY_STATUS_H
14#include "llvm/ADT/StringRef.h"
15#include "llvm/Support/Error.h"
16#include "llvm/Support/FormatVariadic.h"
20#include <system_error>
62 Status(std::error_code EC);
64 explicit Status(
const char *format, ...)
65 __attribute__((format(printf, 2, 3)));
67 template <typename...
Args>
69 return Status(llvm::formatv(format, std::forward<Args>(args)...));
90 const char *
AsCString(
const char *default_error_str =
"unknown error")
const;
120 ...) __attribute__((format(printf, 3, 4)));
164 __attribute__((format(printf, 2, 3)));
168 template <typename...
Args>
170 SetErrorString(llvm::formatv(format, std::forward<Args>(args)...).str());
190 explicit Status(
const llvm::formatv_object_base &payload) {
201 llvm::StringRef Options);
205#define LLDB_ERRORF(status, fmt, ...) \
208 (status)->SetErrorStringWithFormat((fmt), __VA_ARGS__); \
static llvm::raw_ostream & error(Stream &strm)
A command line argument class.
void SetErrorStringWithFormatv(const char *format, Args &&... args)
uint32_t ValueType
Every error value that this object can contain needs to be able to fit into ValueType.
lldb::ErrorType m_type
The type of the above error code.
void Clear()
Clear the object state.
void SetErrorToErrno()
Set the current error to errno.
const Status & operator=(llvm::Error error)
int int SetErrorStringWithVarArg(const char *format, va_list args)
ValueType m_code
Member variables.
static Status createWithFormat(const char *format, Args &&...args)
lldb::ErrorType GetType() const
Access the error type.
void SetErrorToGenericError()
Set the current error to a generic error.
ValueType GetError() const
Access the error value.
Status(llvm::Error error)
llvm::Error ToError() const
void SetExpressionError(lldb::ExpressionResults, const char *mssg)
int SetExpressionErrorWithFormat(lldb::ExpressionResults, const char *format,...) __attribute__((format(printf
int SetErrorStringWithFormat(const char *format,...) __attribute__((format(printf
Set the current error string to a formatted error string.
Status(const llvm::formatv_object_base &payload)
bool Fail() const
Test for error condition.
int void SetError(ValueType err, lldb::ErrorType type)
Set accessor with an error value and type.
const char * AsCString(const char *default_error_str="unknown error") const
Get the error string associated with the current error.
void SetErrorString(llvm::StringRef err_str)
Set the current error string to err_str.
bool Success() const
Test for success condition.
std::string m_string
A string representation of the error code.
A class that represents a running process on the host machine.
@ eErrorTypeGeneric
Generic errors that can be any value.
ExpressionResults
The results of expression evaluation.