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

via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 10 01:23:58 PDT 2024


Author: Shivam Gupta
Date: 2024-06-10T13:53:55+05:30
New Revision: 30bfab3694075cfec9409821be0cfe79ae5d0770

URL: https://github.com/llvm/llvm-project/commit/30bfab3694075cfec9409821be0cfe79ae5d0770
DIFF: https://github.com/llvm/llvm-project/commit/30bfab3694075cfec9409821be0cfe79ae5d0770.diff

LOG: [lldb] Remove redundant condition in watch mask check (NFC) (#94842)

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

Added: 
    

Modified: 
    lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp

Removed: 
    


################################################################################
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);


        


More information about the lldb-commits mailing list