summaryrefslogtreecommitdiff
path: root/contrib/llvm/tools/lldb/source/Utility/Status.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-06-10 19:17:14 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-06-10 19:17:14 +0000
commitdb17bf38c59bc172953ed66cfe1b10c03c6bc383 (patch)
tree2712281fec99b99c2fcafd5b46439dfdd93261aa /contrib/llvm/tools/lldb/source/Utility/Status.cpp
parent686fb94a00297bf9ff49d93b948925552a2ce8e0 (diff)
parent7ab83427af0f77b59941ceba41d509d7d097b065 (diff)
Notes
Diffstat (limited to 'contrib/llvm/tools/lldb/source/Utility/Status.cpp')
-rw-r--r--contrib/llvm/tools/lldb/source/Utility/Status.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/contrib/llvm/tools/lldb/source/Utility/Status.cpp b/contrib/llvm/tools/lldb/source/Utility/Status.cpp
index ba87d3e5144f..6ecc7717620b 100644
--- a/contrib/llvm/tools/lldb/source/Utility/Status.cpp
+++ b/contrib/llvm/tools/lldb/source/Utility/Status.cpp
@@ -11,10 +11,11 @@
#include "lldb/Utility/Status.h"
#include "lldb/Utility/VASPrintf.h"
-#include "lldb/lldb-defines.h" // for LLDB_GENERIC_ERROR
-#include "lldb/lldb-enumerations.h" // for ErrorType, ErrorType::eErr...
-#include "llvm/ADT/SmallString.h" // for SmallString
-#include "llvm/ADT/StringRef.h" // for StringRef
+#include "lldb/lldb-defines.h" // for LLDB_GENERIC_ERROR
+#include "lldb/lldb-enumerations.h" // for ErrorType, ErrorType::eErr...
+#include "llvm/ADT/SmallString.h" // for SmallString
+#include "llvm/ADT/StringRef.h" // for StringRef
+#include "llvm/Support/Errno.h"
#include "llvm/Support/FormatProviders.h" // for format_provider
#include <cerrno>
@@ -27,7 +28,6 @@
#endif
#include <stdint.h> // for uint32_t
-#include <string.h> // for strerror
namespace llvm {
class raw_ostream;
@@ -121,23 +121,21 @@ const char *Status::AsCString(const char *default_error_str) const {
return nullptr;
if (m_string.empty()) {
- const char *s = nullptr;
switch (m_type) {
case eErrorTypeMachKernel:
#if defined(__APPLE__)
- s = ::mach_error_string(m_code);
+ if (const char *s = ::mach_error_string(m_code))
+ m_string.assign(s);
#endif
break;
case eErrorTypePOSIX:
- s = ::strerror(m_code);
+ m_string = llvm::sys::StrError(m_code);
break;
default:
break;
}
- if (s != nullptr)
- m_string.assign(s);
}
if (m_string.empty()) {
if (default_error_str)