#include "lldb/Utility/Status.h"
#include "lldb/Utility/VASPrintf.h"
#include "lldb/lldb-defines.h"
#include "lldb/lldb-enumerations.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Errno.h"
#include "llvm/Support/FormatProviders.h"
#include <cerrno>
#include <cstdarg>
#include <string>
#include <system_error>
#ifdef __APPLE__
#include <mach/mach.h>
#endif
#ifdef _WIN32
#include <windows.h>
#endif
#include <cstdint>
namespace llvm {
class raw_ostream;
}
usingnamespacelldb;
usingnamespacelldb_private;
Status::Status() { … }
Status::Status(ValueType err, ErrorType type, std::string msg)
: … { … }
Status::Status(std::error_code EC)
: … { … }
Status::Status(std::string err_str)
: … { … }
const Status &Status::operator=(llvm::Error error) { … }
Status Status::FromErrorStringWithFormat(const char *format, ...) { … }
llvm::Error Status::ToError() const { … }
Status::~Status() = default;
#ifdef _WIN32
static std::string RetrieveWin32ErrorString(uint32_t error_code) {
char *buffer = nullptr;
std::string message;
if (::FormatMessageA(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_MAX_WIDTH_MASK,
NULL, error_code, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
(LPSTR)&buffer, 0, NULL)) {
message.assign(buffer);
::LocalFree(buffer);
}
else if (::FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_MAX_WIDTH_MASK,
NULL, error_code, 0, (LPSTR)&buffer, 0, NULL)) {
message.assign(buffer);
::LocalFree(buffer);
}
return message;
}
#endif
const char *Status::AsCString(const char *default_error_str) const { … }
void Status::Clear() { … }
Status::ValueType Status::GetError() const { … }
ErrorType Status::GetType() const { … }
bool Status::Fail() const { … }
Status Status::FromErrno() { … }
bool Status::Success() const { … }
void llvm::format_provider<lldb_private::Status>::format(
const lldb_private::Status &error, llvm::raw_ostream &OS,
llvm::StringRef Options) { … }