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

via lldb-commits lldb-commits at lists.llvm.org
Mon May 13 08:37:33 PDT 2024


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

>From 9b4160975efe059f39a842689b1f750a10453203 Mon Sep 17 00:00:00 2001
From: aabhinavg <tiwariabhinavak at gmail.com>
Date: Sun, 12 May 2024 12:42:59 +0530
Subject: [PATCH] Fix redundant condition in Target.cpp

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
---
 lldb/source/Target/Target.cpp | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

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



More information about the lldb-commits mailing list