[Lldb-commits] [lldb] [lldb] Remove redundant condition in watch mask check (NFC) (PR #94842)

via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 7 22:54:08 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Shivam Gupta (xgupta)

<details>
<summary>Changes</summary>

This issue is reported by cppcheck as a pointless test in the watch mask check. The `else if` condition is opposite to the previous `if` condition, making the expression always true.

Caught by cppcheck -
lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp:509:25: style: Expression is always true because 'else if' condition is opposite to previous condition at line 505. [multiCondition]

Fix #<!-- -->91223

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


1 Files Affected:

- (modified) lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp (+1-1) 


``````````diff
diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
index 5ad2f7a8e9455..4668c25eab083 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp
@@ -506,7 +506,7 @@ uint32_t NativeRegisterContextLinux_arm::SetHardwareWatchpoint(
       return LLDB_INVALID_INDEX32;
     else if (watch_mask <= 0x02)
       size = 2;
-    else if (watch_mask <= 0x04)
+    else
       size = 4;
 
     addr = addr & (~0x03);

``````````

</details>


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


More information about the lldb-commits mailing list