diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2020-01-17 20:45:01 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2020-01-17 20:45:01 +0000 |
commit | 706b4fc47bbc608932d3b491ae19a3b9cde9497b (patch) | |
tree | 4adf86a776049cbf7f69a1929c4babcbbef925eb /lldb/source/Utility/Status.cpp | |
parent | 7cc9cf2bf09f069cb2dd947ead05d0b54301fb71 (diff) |
Notes
Diffstat (limited to 'lldb/source/Utility/Status.cpp')
-rw-r--r-- | lldb/source/Utility/Status.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/lldb/source/Utility/Status.cpp b/lldb/source/Utility/Status.cpp index 3d64fb810abf..b74db72773dd 100644 --- a/lldb/source/Utility/Status.cpp +++ b/lldb/source/Utility/Status.cpp @@ -93,16 +93,6 @@ llvm::Error Status::ToError() const { llvm::inconvertibleErrorCode()); } -// Assignment operator -const Status &Status::operator=(const Status &rhs) { - if (this != &rhs) { - m_code = rhs.m_code; - m_type = rhs.m_type; - m_string = rhs.m_string; - } - return *this; -} - Status::~Status() = default; #ifdef _WIN32 @@ -110,14 +100,23 @@ static std::string RetrieveWin32ErrorString(uint32_t error_code) { char *buffer = nullptr; std::string message; // Retrieve win32 system error. + // First, attempt to load a en-US message if (::FormatMessageA( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_MAX_WIDTH_MASK, - NULL, error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + NULL, error_code, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), (LPSTR)&buffer, 0, NULL)) { message.assign(buffer); ::LocalFree(buffer); } + // If the previous didn't work, use the default OS language + 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 |