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

2024-06-10 Thread Shivam Gupta via lldb-commits

https://github.com/xgupta closed https://github.com/llvm/llvm-project/pull/94842
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2024-06-10 Thread Pavel Labath via lldb-commits

https://github.com/labath approved this pull request.


https://github.com/llvm/llvm-project/pull/94842
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2024-06-07 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Shivam Gupta (xgupta)


Changes

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

``




https://github.com/llvm/llvm-project/pull/94842
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


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

2024-06-07 Thread Shivam Gupta via lldb-commits

https://github.com/xgupta created 
https://github.com/llvm/llvm-project/pull/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

>From 12821eca107f3b1b29c5e6d65919322579f8dba8 Mon Sep 17 00:00:00 2001
From: Shivam Gupta 
Date: Sat, 8 Jun 2024 11:19:45 +0530
Subject: [PATCH] [lldb] Remove redundant condition in watch mask check (NFC)

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
---
 .../Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp| 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits