[Lldb-commits] [lldb] ef01c75 - [lldb] Remove dead code block (NFC) (#94775)
via lldb-commits
lldb-commits at lists.llvm.org
Sat Jun 15 11:10:03 PDT 2024
Author: Shivam Gupta
Date: 2024-06-15T23:39:58+05:30
New Revision: ef01c75d467df92b8c659307595aa74ed2290cd8
URL: https://github.com/llvm/llvm-project/commit/ef01c75d467df92b8c659307595aa74ed2290cd8
DIFF: https://github.com/llvm/llvm-project/commit/ef01c75d467df92b8c659307595aa74ed2290cd8.diff
LOG: [lldb] Remove dead code block (NFC) (#94775)
The check that max_bit_pos == sign_bit_pos conflicts with the check that
sign_bit_pos < max_bit_pos in the block surrounding it.
Originally found by cppcheck -
lldb/source/Utility/Scalar.cpp:756:23: warning: Opposite inner 'if'
condition leads to a dead code block. [oppositeInnerCondition]
Fixes #85985
Added:
Modified:
lldb/source/Utility/Scalar.cpp
Removed:
################################################################################
diff --git a/lldb/source/Utility/Scalar.cpp b/lldb/source/Utility/Scalar.cpp
index c70c5e1079918..c680101aa9efa 100644
--- a/lldb/source/Utility/Scalar.cpp
+++ b/lldb/source/Utility/Scalar.cpp
@@ -753,9 +753,7 @@ bool Scalar::SignExtend(uint32_t sign_bit_pos) {
return false;
case Scalar::e_int:
- if (max_bit_pos == sign_bit_pos)
- return true;
- else if (sign_bit_pos < (max_bit_pos - 1)) {
+ if (sign_bit_pos < (max_bit_pos - 1)) {
llvm::APInt sign_bit = llvm::APInt::getSignMask(sign_bit_pos + 1);
llvm::APInt bitwize_and = m_integer & sign_bit;
if (bitwize_and.getBoolValue()) {
More information about the lldb-commits
mailing list