[Lldb-commits] [lldb] [lldb] Fix redundant condition in Target.cpp (PR #91882)

via lldb-commits lldb-commits at lists.llvm.org
Sun May 12 00:18:19 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: None (aabhinavg)

<details>
<summary>Changes</summary>

This commit addresses issue #<!-- -->87244, where a redundant condition was found in the Target.cpp file. Static analyzer cppcheck flagged the issue in the Target.cpp file
fix #<!-- -->87244 

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


1 Files Affected:

- (modified) lldb/source/Target/Target.cpp (+8-6) 


``````````diff
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 82f3040e539a3..fe87728a33dc8 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -841,12 +841,14 @@ static bool CheckIfWatchpointsSupported(Target *target, Status &error) {
   if (!num_supported_hardware_watchpoints)
     return true;
 
-  if (num_supported_hardware_watchpoints == 0) {
-    error.SetErrorStringWithFormat(
-        "Target supports (%u) hardware watchpoint slots.\n",
-        *num_supported_hardware_watchpoints);
-    return false;
-  }
+  // If num_supported_hardware_watchpoints is zero, set an 
+  //error message and return false.
+
+  error.SetErrorStringWithFormat(
+      "Target supports (%u) hardware watchpoint slots.\n",
+      *num_supported_hardware_watchpoints);
+  return false;
+  
   return true;
 }
 

``````````

</details>


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


More information about the lldb-commits mailing list