[Lldb-commits] [lldb] [LLDB] [NFC] Fix a cppcheck warning in lldb/source/Utility/Scalar.cpp (PR #94775)

via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 7 10:51:30 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Shivam Gupta (xgupta)

<details>
<summary>Changes</summary>

Fixes #<!-- -->85985

lldb/source/Utility/Scalar.cpp:756:23: warning: Opposite inner 'if' condition leads to a dead code block. [oppositeInnerCondition]

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


1 Files Affected:

- (modified) lldb/source/Utility/Scalar.cpp (+1-3) 


``````````diff
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()) {

``````````

</details>


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


More information about the lldb-commits mailing list