diff options
Diffstat (limited to 'lldb/source/Host/common')
| -rw-r--r-- | lldb/source/Host/common/Host.cpp | 2 | ||||
| -rw-r--r-- | lldb/source/Host/common/HostNativeThreadBase.cpp | 6 | ||||
| -rw-r--r-- | lldb/source/Host/common/Socket.cpp | 5 | ||||
| -rw-r--r-- | lldb/source/Host/common/Terminal.cpp | 2 | ||||
| -rw-r--r-- | lldb/source/Host/common/XML.cpp | 29 |
5 files changed, 24 insertions, 20 deletions
diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp index d14ebe99fd15..53a096c617df 100644 --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -191,7 +191,7 @@ static thread_result_t MonitorChildProcessThreadFunction(void *arg) { ::sigaction(SIGUSR1, &sigUsr1Action, nullptr); #endif // __linux__ - while (1) { + while (true) { log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS); LLDB_LOGF(log, "%s ::waitpid (pid = %" PRIi32 ", &status, options = %i)...", function, pid, options); diff --git a/lldb/source/Host/common/HostNativeThreadBase.cpp b/lldb/source/Host/common/HostNativeThreadBase.cpp index b15160b143ca..b8223e3ec42a 100644 --- a/lldb/source/Host/common/HostNativeThreadBase.cpp +++ b/lldb/source/Host/common/HostNativeThreadBase.cpp @@ -18,7 +18,7 @@ using namespace lldb; using namespace lldb_private; HostNativeThreadBase::HostNativeThreadBase(thread_t thread) - : m_thread(thread), m_result(0) {} + : m_thread(thread), m_result(0) {} // NOLINT(modernize-use-nullptr) lldb::thread_t HostNativeThreadBase::GetSystemHandle() const { return m_thread; @@ -34,7 +34,7 @@ bool HostNativeThreadBase::IsJoinable() const { void HostNativeThreadBase::Reset() { m_thread = LLDB_INVALID_HOST_THREAD; - m_result = 0; + m_result = 0; // NOLINT(modernize-use-nullptr) } bool HostNativeThreadBase::EqualsThread(lldb::thread_t thread) const { @@ -44,7 +44,7 @@ bool HostNativeThreadBase::EqualsThread(lldb::thread_t thread) const { lldb::thread_t HostNativeThreadBase::Release() { lldb::thread_t result = m_thread; m_thread = LLDB_INVALID_HOST_THREAD; - m_result = 0; + m_result = 0; // NOLINT(modernize-use-nullptr) return result; } diff --git a/lldb/source/Host/common/Socket.cpp b/lldb/source/Host/common/Socket.cpp index cc0659797530..d8b8f54a6468 100644 --- a/lldb/source/Host/common/Socket.cpp +++ b/lldb/source/Host/common/Socket.cpp @@ -18,6 +18,7 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/Support/Errno.h" #include "llvm/Support/Error.h" +#include "llvm/Support/Regex.h" #include "llvm/Support/WindowsError.h" #if LLDB_ENABLE_POSIX @@ -281,9 +282,9 @@ Status Socket::Close() { static_cast<void *>(this), static_cast<uint64_t>(m_socket)); #if defined(_WIN32) - bool success = !!closesocket(m_socket); + bool success = closesocket(m_socket) == 0; #else - bool success = !!::close(m_socket); + bool success = ::close(m_socket) == 0; #endif // A reference to a FD was passed in, set it to an invalid value m_socket = kInvalidSocketValue; diff --git a/lldb/source/Host/common/Terminal.cpp b/lldb/source/Host/common/Terminal.cpp index 2a1c12e667bc..831e9dff4eb1 100644 --- a/lldb/source/Host/common/Terminal.cpp +++ b/lldb/source/Host/common/Terminal.cpp @@ -417,8 +417,8 @@ bool TerminalState::Save(Terminal term, bool save_process_group) { Clear(); m_tty = term; if (m_tty.IsATerminal()) { - int fd = m_tty.GetFileDescriptor(); #if LLDB_ENABLE_POSIX + int fd = m_tty.GetFileDescriptor(); m_tflags = ::fcntl(fd, F_GETFL, 0); #if LLDB_ENABLE_TERMIOS std::unique_ptr<Terminal::Data> new_data{new Terminal::Data()}; diff --git a/lldb/source/Host/common/XML.cpp b/lldb/source/Host/common/XML.cpp index 79128b98dc38..2d48175a8234 100644 --- a/lldb/source/Host/common/XML.cpp +++ b/lldb/source/Host/common/XML.cpp @@ -130,22 +130,25 @@ XMLNode XMLNode::GetChild() const { #endif } -llvm::StringRef XMLNode::GetAttributeValue(const char *name, - const char *fail_value) const { - const char *attr_value = nullptr; +std::string XMLNode::GetAttributeValue(const char *name, + const char *fail_value) const { + std::string attr_value; #if LLDB_ENABLE_LIBXML2 - - if (IsValid()) - attr_value = (const char *)xmlGetProp(m_node, (const xmlChar *)name); - else - attr_value = fail_value; + if (IsValid()) { + xmlChar *value = xmlGetProp(m_node, (const xmlChar *)name); + if (value) { + attr_value = (const char *)value; + xmlFree(value); + } + } else { + if (fail_value) + attr_value = fail_value; + } #else - attr_value = fail_value; + if (fail_value) + attr_value = fail_value; #endif - if (attr_value) - return llvm::StringRef(attr_value); - else - return llvm::StringRef(); + return attr_value; } bool XMLNode::GetAttributeValueAsUnsigned(const char *name, uint64_t &value, |
