[Lldb-commits] [lldb] [lldb] Fix redundant condition in compression type check (NFC) (PR #94841)
Shivam Gupta via lldb-commits
lldb-commits at lists.llvm.org
Fri Jun 7 22:46:03 PDT 2024
https://github.com/xgupta created https://github.com/llvm/llvm-project/pull/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
>From 5451d769f36528e9640e665d4124103a6c34bf20 Mon Sep 17 00:00:00 2001
From: Shivam Gupta <shivam98.tkg at gmail.com>
Date: Sat, 8 Jun 2024 11:14:06 +0530
Subject: [PATCH] [lldb] Fix redundant condition in compression type check
(NFC)
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
---
.../Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp | 2 --
1 file changed, 2 deletions(-)
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;
More information about the lldb-commits
mailing list