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

via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 10 01:23:43 PDT 2024


Author: Shivam Gupta
Date: 2024-06-10T13:53:39+05:30
New Revision: 0af2e75f8c688cc6fb7123c969c8edfa98a003fa

URL: https://github.com/llvm/llvm-project/commit/0af2e75f8c688cc6fb7123c969c8edfa98a003fa
DIFF: https://github.com/llvm/llvm-project/commit/0af2e75f8c688cc6fb7123c969c8edfa98a003fa.diff

LOG: [lldb] Fix redundant condition in compression type check (NFC) (#94841)

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

Added: 
    

Modified: 
    lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index 8a47eed3d7cbe..187370eb36cae 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -539,9 +539,8 @@ bool GDBRemoteCommunication::DecompressPacket() {
       else if (m_compression_type == CompressionType::ZlibDeflate)
         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);
+        scratchbuf_size =
+            compression_decode_scratch_buffer_size(COMPRESSION_LZMA);
       if (scratchbuf_size > 0) {
         m_decompression_scratch = (void*) malloc (scratchbuf_size);
         m_decompression_scratch_type = m_compression_type;


        


More information about the lldb-commits mailing list