Skip to content

Commit

Permalink
[lldb] Remove dead code block (NFC) (#94775)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
xgupta authored Jun 15, 2024
1 parent e48f211 commit ef01c75
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lldb/source/Utility/Scalar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down

0 comments on commit ef01c75

Please sign in to comment.