[Lldb-commits] [lldb] [lldb] Fix redundant condition in compression type check (NFC) (PR #94841)

via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 7 22:46:33 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Shivam Gupta (xgupta)

<details>
<summary>Changes</summary>

The `else if` condition for checking `m_compression_type` is redundant as it matches with a previous `if` condition, making the expression always false. Reported by cppcheck as a possible cut-and-paste error.

Caught by cppcheck -
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp:543:35: style: Expression is always false because 'else if' condition matches previous condition at line 535. [multiCondition]

Fix #<!-- -->91222

---
Full diff: https://github.com/llvm/llvm-project/pull/94841.diff


1 Files Affected:

- (modified) lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (-2) 


``````````diff
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index 8a47eed3d7cbe..52bf8533bbd8a 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -540,8 +540,6 @@ bool GDBRemoteCommunication::DecompressPacket() {
         scratchbuf_size = compression_decode_scratch_buffer_size (COMPRESSION_ZLIB);
       else if (m_compression_type == CompressionType::LZMA)
         scratchbuf_size = compression_decode_scratch_buffer_size (COMPRESSION_LZMA);
-      else if (m_compression_type == CompressionType::LZFSE)
-        scratchbuf_size = compression_decode_scratch_buffer_size (COMPRESSION_LZFSE);
       if (scratchbuf_size > 0) {
         m_decompression_scratch = (void*) malloc (scratchbuf_size);
         m_decompression_scratch_type = m_compression_type;

``````````

</details>


https://github.com/llvm/llvm-project/pull/94841


More information about the lldb-commits mailing list