summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2019-01-25 08:21:47 +0000
committerRaphael Isemann <teemperor@gmail.com>2019-01-25 08:21:47 +0000
commit46508f6f1165795ac85a5bedd876cb117dc23dbe (patch)
tree117fd49b556fc322167a213a5a646c9275ccfc56 /lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
parent308a609c6ee984414f68f1e106cdc1aab5f14277 (diff)
downloadbcm5719-llvm-46508f6f1165795ac85a5bedd876cb117dc23dbe.tar.gz
bcm5719-llvm-46508f6f1165795ac85a5bedd876cb117dc23dbe.zip
Refactor HAVE_LIBCOMPRESSION and related code in GDBRemoteCommunication
Summary: The field `m_decompression_scratch_type` is only used when `HAVE_LIBCOMPRESSION` is defined, which caused a warning which I fixed in rLLDB350675 by just marking the variable as always used. This patch fixes this in a better way by only defining the variable (and the related `m_decompression_scratch` variable) when `HAVE_LIBCOMPRESSION` is defined. This also required changing the way we handle `HAVE_LIBCOMPRESSION` works, as this was previously always defined on macOS within the source file but not in the header. Now it's always defined from within our config header when CMake defines it or when we are on macOS. The field initialization was moved to the header to prevent that we have `#ifdef` within our initializer list. Reviewers: #lldb, jasonmolenda, sgraenitz, labath Reviewed By: labath Subscribers: labath, beanz, mgorny, lldb-commits, dblaikie Differential Revision: https://reviews.llvm.org/D57011 llvm-svn: 352175
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index a617e7c80d3..8133ee567f1 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -41,8 +41,7 @@
#define DEBUGSERVER_BASENAME "lldb-server"
#endif
-#if defined(__APPLE__)
-#define HAVE_LIBCOMPRESSION
+#if defined(HAVE_LIBCOMPRESSION)
#include <compression.h>
#endif
@@ -67,10 +66,7 @@ GDBRemoteCommunication::GDBRemoteCommunication(const char *comm_name,
#endif
m_echo_number(0), m_supports_qEcho(eLazyBoolCalculate), m_history(512),
m_send_acks(true), m_compression_type(CompressionType::None),
- m_listen_url(), m_decompression_scratch_type(CompressionType::None),
- m_decompression_scratch(nullptr) {
- // Unused unless HAVE_LIBCOMPRESSION is defined.
- (void)m_decompression_scratch_type;
+ m_listen_url() {
}
//----------------------------------------------------------------------
@@ -81,8 +77,10 @@ GDBRemoteCommunication::~GDBRemoteCommunication() {
Disconnect();
}
+#if defined(HAVE_LIBCOMPRESSION)
if (m_decompression_scratch)
free (m_decompression_scratch);
+#endif
// Stop the communications read thread which is used to parse all incoming
// packets. This function will block until the read thread returns.
OpenPOWER on IntegriCloud